<!DOCTYPE html>
<!--

	Modified template for STM32CubeMX.AI purpose

	d0.1: 	jean-michel.delorme@st.com
			add ST logo and ST footer

	d2.0: 	jean-michel.delorme@st.com
			add sidenav support

	d2.1: 	jean-michel.delorme@st.com
			clean-up + optional ai_logo/ai meta data
			
==============================================================================
           "GitHub HTML5 Pandoc Template" v2.1 — by Tristano Ajmone           
==============================================================================
Copyright © Tristano Ajmone, 2017, MIT License (MIT). Project's home:

- https://github.com/tajmone/pandoc-goodies

The CSS in this template reuses source code taken from the following projects:

- GitHub Markdown CSS: Copyright © Sindre Sorhus, MIT License (MIT):
  https://github.com/sindresorhus/github-markdown-css

- Primer CSS: Copyright © 2016-2017 GitHub Inc., MIT License (MIT):
  http://primercss.io/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The MIT License 

Copyright (c) Tristano Ajmone, 2017 (github.com/tajmone/pandoc-goodies)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Copyright (c) 2017 GitHub Inc.

"GitHub Pandoc HTML5 Template" is Copyright (c) Tristano Ajmone, 2017, released
under the MIT License (MIT); it contains readaptations of substantial portions
of the following third party softwares:

(1) "GitHub Markdown CSS", Copyright (c) Sindre Sorhus, MIT License (MIT).
(2) "Primer CSS", Copyright (c) 2016 GitHub Inc., MIT License (MIT).

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
==============================================================================-->
<html>
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="pandoc" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
  <meta name="keywords" content="STM32CubeMX, X-CUBE-AI, Neural Network, Quantization support, CLI, Code Generator, Automatic NN mapping tools" />
  <title>Command Line Interface</title>
  <style type="text/css">
.markdown-body{
	-ms-text-size-adjust:100%;
	-webkit-text-size-adjust:100%;
	color:#24292e;
	font-family:-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
	font-size:16px;
	line-height:1.5;
	word-wrap:break-word;
	box-sizing:border-box;
	min-width:200px;
	max-width:980px;
	margin:0 auto;
	padding:45px;
	}
.markdown-body a{
	color:#0366d6;
	background-color:transparent;
	text-decoration:none;
	-webkit-text-decoration-skip:objects}
.markdown-body a:active,.markdown-body a:hover{
	outline-width:0}
.markdown-body a:hover{
	text-decoration:underline}
.markdown-body a:not([href]){
	color:inherit;text-decoration:none}
.markdown-body strong{font-weight:600}
.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6{
	margin-top:24px;
	margin-bottom:16px;
	font-weight:600;
	line-height:1.25}
.markdown-body h1{
	font-size:2em;
	margin:.67em 0;
	padding-bottom:.3em;
	border-bottom:1px solid #eaecef}
.markdown-body h2{
	padding-bottom:.3em;
	font-size:1.5em;
	border-bottom:1px solid #eaecef}
.markdown-body h3{font-size:1.25em}
.markdown-body h4{font-size:1em}
.markdown-body h5{font-size:.875em}
.markdown-body h6{font-size:.85em;color:#6a737d}
.markdown-body img{border-style:none}
.markdown-body svg:not(:root){
	overflow:hidden}
.markdown-body hr{
	box-sizing:content-box;
	height:.25em;
	margin:24px 0;
	padding:0;
	overflow:hidden;
	background-color:#e1e4e8;
	border:0}
.markdown-body hr::before{display:table;content:""}
.markdown-body hr::after{display:table;clear:both;content:""}
.markdown-body input{margin:0;overflow:visible;font:inherit;font-family:inherit;font-size:inherit;line-height:inherit}
.markdown-body [type=checkbox]{box-sizing:border-box;padding:0}
.markdown-body *{box-sizing:border-box}.markdown-body blockquote{margin:0}
.markdown-body ol,.markdown-body ul{padding-left:2em}
.markdown-body ol ol,.markdown-body ul ol{list-style-type:lower-roman}
.markdown-body ol ol,.markdown-body ol ul,.markdown-body ul ol,.markdown-body ul ul{margin-top:0;margin-bottom:0}
.markdown-body ol ol ol,.markdown-body ol ul ol,.markdown-body ul ol ol,.markdown-body ul ul ol{list-style-type:lower-alpha}
.markdown-body li>p{margin-top:16px}
.markdown-body li+li{margin-top:.25em}
.markdown-body dd{margin-left:0}
.markdown-body dl{padding:0}
.markdown-body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:600}
.markdown-body dl dd{padding:0 16px;margin-bottom:16px}
.markdown-body code{font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace}
.markdown-body pre{font:12px SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;word-wrap:normal}
.markdown-body blockquote,.markdown-body dl,.markdown-body ol,.markdown-body p,.markdown-body pre,.markdown-body table,.markdown-body ul{margin-top:0;margin-bottom:16px}
.markdown-body blockquote{padding:0 1em;color:#6a737d;border-left:.25em solid #dfe2e5}
.markdown-body blockquote>:first-child{margin-top:0}
.markdown-body blockquote>:last-child{margin-bottom:0}
.markdown-body table{display:block;width:100%;overflow:auto;border-spacing:0;border-collapse:collapse}
.markdown-body table th{font-weight:600}
.markdown-body table td,.markdown-body table th{padding:6px 13px;border:1px solid #dfe2e5}
.markdown-body table tr{background-color:#fff;border-top:1px solid #c6cbd1}
.markdown-body table tr:nth-child(2n){background-color:#f6f8fa}
.markdown-body img{max-width:100%;box-sizing:content-box;background-color:#fff}
.markdown-body code{padding:.2em 0;margin:0;font-size:85%;background-color:rgba(27,31,35,.05);border-radius:3px}
.markdown-body code::after,.markdown-body code::before{letter-spacing:-.2em;content:"\00a0"}
.markdown-body pre>code{padding:0;margin:0;font-size:100%;word-break:normal;white-space:pre;background:0 0;border:0}
.markdown-body .highlight{margin-bottom:16px}
.markdown-body .highlight pre{margin-bottom:0;word-break:normal}
.markdown-body .highlight pre,.markdown-body pre{padding:16px;overflow:auto;font-size:85%;line-height:1.45;background-color:#f6f8fa;border-radius:3px}
.markdown-body pre code{display:inline;max-width:auto;padding:0;margin:0;overflow:visible;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}
.markdown-body pre code::after,.markdown-body pre code::before{content:normal}
.markdown-body .full-commit .btn-outline:not(:disabled):hover{color:#005cc5;border-color:#005cc5}
.markdown-body kbd{box-shadow:inset 0 -1px 0 #959da5;display:inline-block;padding:3px 5px;font:11px/10px SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;color:#444d56;vertical-align:middle;background-color:#fcfcfc;border:1px solid #c6cbd1;border-bottom-color:#959da5;border-radius:3px;box-shadow:inset 0 -1px 0 #959da5}
.markdown-body :checked+.radio-label{position:relative;z-index:1;border-color:#0366d6}
.markdown-body .task-list-item{list-style-type:none}
.markdown-body .task-list-item+.task-list-item{margin-top:3px}
.markdown-body .task-list-item input{margin:0 .2em .25em -1.6em;vertical-align:middle}
.markdown-body::before{display:table;content:""}
.markdown-body::after{display:table;clear:both;content:""}
.markdown-body>:first-child{margin-top:0!important}
.markdown-body>:last-child{margin-bottom:0!important}
.Alert,.Error,.Note,.Success,.Warning,.Tips,.HTips{padding:11px;margin-bottom:24px;border-style:solid;border-width:1px;border-radius:4px}
.Alert p,.Error p,.Note p,.Success p,.Warning p,.Tips p,.HTips p{margin-top:0}
.Alert p:last-child,.Error p:last-child,.Note p:last-child,.Success p:last-child,.Warning p:last-child,.Tips p:last-child,.HTips p:last-child{margin-bottom:0}
.Alert{color:#246;background-color:#e2eef9;border-color:#bac6d3}
.Warning{color:#4c4a42;background-color:#fff9ea;border-color:#dfd8c2}
.Error{color:#911;background-color:#fcdede;border-color:#d2b2b2}
.Success{color:#22662c;background-color:#e2f9e5;border-color:#bad3be}
.Note{color:#2f363d;background-color:#f6f8fa;border-color:#d5d8da}
.Alert h1,.Alert h2,.Alert h3,.Alert h4,.Alert h5,.Alert h6{color:#246;margin-bottom:0}
.Warning h1,.Warning h2,.Warning h3,.Warning h4,.Warning h5,.Warning h6{color:#4c4a42;margin-bottom:0}
.Error h1,.Error h2,.Error h3,.Error h4,.Error h5,.Error h6{color:#911;margin-bottom:0}
.Success h1,.Success h2,.Success h3,.Success h4,.Success h5,.Success h6{color:#22662c;margin-bottom:0}
.Note h1,.Note h2,.Note h3,.Note h4,.Note h5,.Note h6{color:#2f363d;margin-bottom:0}
.Tips h1,.Tips h2,.Tips h3,.Tips h4,.Tips h5,.Tips h6{color:#2f363d;margin-bottom:0}
.HTips h1,.HTips h2,.HTips h3,.HTips h4,.HTips h5,.HTips h6{color:#2f363d;margin-bottom:0}
.Tips h1:first-child,.Tips h2:first-child,.Tips h3:first-child,.Tips h4:first-child,.Tips h5:first-child,.Tips h6:first-child,.Alert h1:first-child,.Alert h2:first-child,.Alert h3:first-child,.Alert h4:first-child,.Alert h5:first-child,.Alert h6:first-child,.Error h1:first-child,.Error h2:first-child,.Error h3:first-child,.Error h4:first-child,.Error h5:first-child,.Error h6:first-child,.Note h1:first-child,.Note h2:first-child,.Note h3:first-child,.Note h4:first-child,.Note h5:first-child,.Note h6:first-child,.Success h1:first-child,.Success h2:first-child,.Success h3:first-child,.Success h4:first-child,.Success h5:first-child,.Success h6:first-child,.Warning h1:first-child,.Warning h2:first-child,.Warning h3:first-child,.Warning h4:first-child,.Warning h5:first-child,.Warning h6:first-child{margin-top:0}
h1.title,p.subtitle{text-align:center}
h1.title.followed-by-subtitle{margin-bottom:0}
p.subtitle{font-size:1.5em;font-weight:600;line-height:1.25;margin-top:0;margin-bottom:16px;padding-bottom:.3em}
div.line-block{white-space:pre-line}
  </style>
  <style type="text/css">code{white-space: pre;}</style>
  <style type="text/css">
	pre > code.sourceCode { white-space: pre; position: relative; }
 pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
 pre > code.sourceCode > span:empty { height: 1.2em; }
 .sourceCode { overflow: visible; }
 code.sourceCode > span { color: inherit; text-decoration: inherit; }
 div.sourceCode { margin: 1em 0; }
 pre.sourceCode { margin: 0; }
 @media screen {
 div.sourceCode { overflow: auto; }
 }
 @media print {
 pre > code.sourceCode { white-space: pre-wrap; }
 pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
 }
 pre.numberSource code
   { counter-reset: source-line 0; }
 pre.numberSource code > span
   { position: relative; left: -4em; counter-increment: source-line; }
 pre.numberSource code > span > a:first-child::before
   { content: counter(source-line);
     position: relative; left: -1em; text-align: right; vertical-align: baseline;
     border: none; display: inline-block;
     -webkit-touch-callout: none; -webkit-user-select: none;
     -khtml-user-select: none; -moz-user-select: none;
     -ms-user-select: none; user-select: none;
     padding: 0 4px; width: 4em;
     background-color: #ffffff;
     color: #a0a0a0;
   }
 pre.numberSource { margin-left: 3em; border-left: 1px solid #a0a0a0;  padding-left: 4px; }
 div.sourceCode
   { color: #1f1c1b; background-color: #ffffff; }
 @media screen {
 pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
 }
 code span { color: #1f1c1b; } /* Normal */
 code span.al { color: #bf0303; background-color: #f7e6e6; font-weight: bold; } /* Alert */
 code span.an { color: #ca60ca; } /* Annotation */
 code span.at { color: #0057ae; } /* Attribute */
 code span.bn { color: #b08000; } /* BaseN */
 code span.bu { color: #644a9b; font-weight: bold; } /* BuiltIn */
 code span.cf { color: #1f1c1b; font-weight: bold; } /* ControlFlow */
 code span.ch { color: #924c9d; } /* Char */
 code span.cn { color: #aa5500; } /* Constant */
 code span.co { color: #898887; } /* Comment */
 code span.cv { color: #0095ff; } /* CommentVar */
 code span.do { color: #607880; } /* Documentation */
 code span.dt { color: #0057ae; } /* DataType */
 code span.dv { color: #b08000; } /* DecVal */
 code span.er { color: #bf0303; text-decoration: underline; } /* Error */
 code span.ex { color: #0095ff; font-weight: bold; } /* Extension */
 code span.fl { color: #b08000; } /* Float */
 code span.fu { color: #644a9b; } /* Function */
 code span.im { color: #ff5500; } /* Import */
 code span.in { color: #b08000; } /* Information */
 code span.kw { color: #1f1c1b; font-weight: bold; } /* Keyword */
 code span.op { color: #1f1c1b; } /* Operator */
 code span.ot { color: #006e28; } /* Other */
 code span.pp { color: #006e28; } /* Preprocessor */
 code span.re { color: #0057ae; background-color: #e0e9f8; } /* RegionMarker */
 code span.sc { color: #3daee9; } /* SpecialChar */
 code span.ss { color: #ff5500; } /* SpecialString */
 code span.st { color: #bf0303; } /* String */
 code span.va { color: #0057ae; } /* Variable */
 code span.vs { color: #bf0303; } /* VerbatimString */
 code span.wa { color: #bf0303; } /* Warning */
  </style>
  <link rel="stylesheet" href="data:text/css,%3Aroot%20%7B%2D%2Dmain%2Ddarkblue%2Dcolor%3A%20rgb%283%2C35%2C75%29%3B%20%2D%2Dmain%2Dlightblue%2Dcolor%3A%20rgb%2860%2C180%2C230%29%3B%20%2D%2Dmain%2Dpink%2Dcolor%3A%20rgb%28230%2C0%2C126%29%3B%20%2D%2Dmain%2Dyellow%2Dcolor%3A%20rgb%28255%2C210%2C0%29%3B%20%2D%2Dsecondary%2Dgrey%2Dcolor%3A%20rgb%2870%2C70%2C80%29%3B%20%2D%2Dsecondary%2Dgrey%2Dcolor%2D25%3A%20rgb%28209%2C209%2C211%29%3B%20%2D%2Dsecondary%2Dgrey%2Dcolor%2D12%3A%20rgb%28233%2C233%2C234%29%3B%20%2D%2Dsecondary%2Dlightgreen%2Dcolor%3A%20rgb%2873%2C177%2C112%29%3B%20%2D%2Dsecondary%2Dpurple%2Dcolor%3A%20rgb%28140%2C0%2C120%29%3B%20%2D%2Dsecondary%2Ddarkgreen%2Dcolor%3A%20rgb%284%2C87%2C47%29%3B%20%2D%2Dsidenav%2Dfont%2Dsize%3A%2090%25%3B%7Dhtml%20%7Bfont%2Dfamily%3A%20%22Arial%22%2C%20sans%2Dserif%3B%7D%2A%20%7Bxbox%2Dsizing%3A%20border%2Dbox%3B%7D%2Est%5Fheader%20h1%2Etitle%2C%2Est%5Fheader%20p%2Esubtitle%20%7Btext%2Dalign%3A%20left%3B%7D%2Est%5Fheader%20h1%2Etitle%20%7Bborder%2Dcolor%3A%20var%28%2D%2Dmain%2Ddarkblue%2Dcolor%29%3Bmargin%2Dbottom%3A5px%3B%7D%2Est%5Fheader%20p%2Esubtitle%20%7Bcolor%3A%20var%28%2D%2Dmain%2Ddarkblue%2Dcolor%29%3Bfont%2Dsize%3A90%25%3B%7D%2Est%5Fheader%20h1%2Etitle%2Efollowed%2Dby%2Dsubtitle%20%7Bborder%2Dbottom%3A2px%20solid%3Bborder%2Dcolor%3A%20var%28%2D%2Dmain%2Ddarkblue%2Dcolor%29%3Bmargin%2Dbottom%3A5px%3B%7D%2Est%5Fheader%20p%2Erevision%20%7Bdisplay%3A%20inline%2Dblock%3Bwidth%3A70%25%3B%7D%2Est%5Fheader%20div%2Eauthor%20%7Bfont%2Dstyle%3A%20italic%3B%7D%2Est%5Fheader%20div%2Esummary%20%7Bborder%2Dtop%3A%20solid%201px%20%23C0C0C0%3Bbackground%3A%20%23ECECEC%3Bpadding%3A%205px%3B%7D%2Est%5Ffooter%20%7Bfont%2Dsize%3A80%25%3B%7D%2Est%5Ffooter%20img%20%7Bfloat%3A%20right%3B%7D%2Est%5Ffooter%20%2Est%5Fnotice%20%7Bwidth%3A80%25%3B%7D%2Emarkdown%2Dbody%20%23header%2Dsection%2Dnumber%20%7Bfont%2Dsize%3A120%25%3B%7D%2Emarkdown%2Dbody%20h1%20%7Bborder%2Dbottom%3A1px%20solid%3Bborder%2Dcolor%3A%20var%28%2D%2Dmain%2Ddarkblue%2Dcolor%29%3Bpadding%2Dbottom%3A%202px%3Bpadding%2Dtop%3A%2010px%3B%7D%2Emarkdown%2Dbody%20h2%20%7Bpadding%2Dbottom%3A%205px%3Bpadding%2Dtop%3A%2010px%3B%7D%2Emarkdown%2Dbody%20h2%20code%20%7Bbackground%2Dcolor%3A%20rgb%28255%2C%20255%2C%20255%29%3B%7D%23func%2EsourceCode%20%7Bborder%2Dleft%2Dstyle%3A%20solid%3Bborder%2Dcolor%3A%20rgb%280%2C%2032%2C%2082%29%3Bborder%2Dcolor%3A%20rgb%28255%2C%20244%2C%20191%29%3Bborder%2Dwidth%3A%208px%3Bpadding%3A0px%3B%7Dpre%20%3E%20code%20%7Bborder%3A%20solid%201px%20blue%3Bfont%2Dsize%3A60%25%3B%7DcodeXX%20%7Bborder%3A%20solid%201px%20blue%3Bfont%2Dsize%3A60%25%3B%7D%23func%2EsourceXXCode%3A%3Abefore%20%7Bcontent%3A%20%22Synopsis%22%3Bpadding%2Dleft%3A10px%3Bfont%2Dweight%3A%20bold%3B%7Dfigure%20%7Bpadding%3A0px%3Bmargin%2Dleft%3A5px%3Bmargin%2Dright%3A5px%3Bmargin%2Dleft%3A%20auto%3Bmargin%2Dright%3A%20auto%3B%7Dimg%5Bdata%2Dproperty%3D%22center%22%5D%20%7Bdisplay%3A%20block%3Bmargin%2Dtop%3A%2010px%3Bmargin%2Dleft%3A%20auto%3Bmargin%2Dright%3A%20auto%3Bpadding%3A%2010px%3B%7Dfigcaption%20%7Btext%2Dalign%3Aleft%3B%20%20border%2Dtop%3A%201px%20dotted%20%23888%3Bpadding%2Dbottom%3A%2020px%3Bmargin%2Dtop%3A%2010px%3B%7Dh1%20code%2C%20h2%20code%20%7Bfont%2Dsize%3A120%25%3B%7D%09%2Emarkdown%2Dbody%20table%20%7Bwidth%3A%20100%25%3Bmargin%2Dleft%3Aauto%3Bmargin%2Dright%3Aauto%3B%7D%2Emarkdown%2Dbody%20img%20%7Bborder%2Dradius%3A%204px%3Bpadding%3A%205px%3Bdisplay%3A%20block%3Bmargin%2Dleft%3A%20auto%3Bmargin%2Dright%3A%20auto%3Bwidth%3A%20auto%3B%7D%2Emarkdown%2Dbody%20%2Est%5Fheader%20img%2C%20%2Emarkdown%2Dbody%20%7Bborder%3A%20none%3Bborder%2Dradius%3A%20none%3Bpadding%3A%205px%3Bdisplay%3A%20block%3Bmargin%2Dleft%3A%20auto%3Bmargin%2Dright%3A%20auto%3Bwidth%3A%20auto%3Bbox%2Dshadow%3A%20none%3B%7D%2Emarkdown%2Dbody%20%7Bmargin%3A%2010px%3Bpadding%3A%2010px%3Bwidth%3A%20auto%3Bfont%2Dfamily%3A%20%22Arial%22%2C%20sans%2Dserif%3Bcolor%3A%20%2303234B%3Bcolor%3A%20var%28%2D%2Dmain%2Ddarkblue%2Dcolor%29%7D%2Emarkdown%2Dbody%20h1%2C%20%2Emarkdown%2Dbody%20h2%2C%20%2Emarkdown%2Dbody%20h3%20%7B%20%20%20color%3A%20var%28%2D%2Dmain%2Ddarkblue%2Dcolor%29%7D%2Emarkdown%2Dbody%3Ahover%20%7B%7D%2Emarkdown%2Dbody%20%2Econtents%20%7B%7D%2Emarkdown%2Dbody%20%2Etoc%2Dtitle%20%7B%7D%2Emarkdown%2Dbody%20%2Econtents%20li%20%7Blist%2Dstyle%2Dtype%3A%20none%3B%7D%2Emarkdown%2Dbody%20%2Econtents%20ul%20%7Bpadding%2Dleft%3A%2010px%3B%7D%2Emarkdown%2Dbody%20%2Econtents%20a%20%7Bcolor%3A%20%233CB4E6%3B%20%7D%2Emarkdown%2Dbody%20table%20%2Eheader%20%7Bbackground%2Dcolor%3A%20var%28%2D%2Dsecondary%2Dgrey%2Dcolor%2D12%29%3Bborder%2Dbottom%3A1px%20solid%3Bborder%2Dtop%3A1px%20solid%3Bfont%2Dsize%3A%2090%25%3B%7D%2Emarkdown%2Dbody%20table%20th%20%7Bfont%2Dweight%3A%20bolder%3B%20%7D%2Emarkdown%2Dbody%20table%20td%20%7Bfont%2Dsize%3A%2090%25%3B%7D%2Emarkdown%2Dbody%20code%7Bpadding%3A%200%3Bmargin%3A0%3Bfont%2Dsize%3A95%25%3Bbackground%2Dcolor%3Argba%2827%2C31%2C35%2C%2E05%29%3Bborder%2Dradius%3A1px%3B%7D%2Et01%20%7Bwidth%3A%20100%25%3Bborder%3A%20None%3Btext%2Dalign%3A%20left%3B%7D%2ETips%20%7Bpadding%3A11px%3Bmargin%2Dbottom%3A24px%3Bborder%2Dstyle%3Asolid%3Bborder%2Dwidth%3A1px%3Bborder%2Dradius%3A1px%7D%2ETips%20%7Bcolor%3A%232f363d%3B%20background%2Dcolor%3A%20%23f6f8fa%3Bborder%2Dcolor%3A%23d5d8da%3Bborder%2Dtop%3A1px%20solid%3Bborder%2Dbottom%3A1px%20solid%3B%7D%2EHTips%20%7Bpadding%3A11px%3Bmargin%2Dbottom%3A24px%3Bborder%2Dstyle%3Asolid%3Bborder%2Dwidth%3A1px%3Bborder%2Dradius%3A1px%7D%2EHTips%20%7Bcolor%3A%232f363d%3B%20background%2Dcolor%3A%23fff9ea%3Bborder%2Dcolor%3A%23d5d8da%3Bborder%2Dtop%3A1px%20solid%3Bborder%2Dbottom%3A1px%20solid%3B%7D%2EHTips%20h1%2C%2EHTips%20h2%2C%2EHTips%20h3%2C%2EHTips%20h4%2C%2EHTips%20h5%2C%2EHTips%20h6%20%7Bcolor%3A%232f363d%3Bmargin%2Dbottom%3A0%7D%2Esidenav%20%7Bfont%2Dfamily%3A%20%22Arial%22%2C%20sans%2Dserif%3B%20%20color%3A%20var%28%2D%2Dmain%2Ddarkblue%2Dcolor%29%3Bheight%3A%20100%25%3Bposition%3A%20fixed%3Bz%2Dindex%3A%201%3Btop%3A%200%3Bleft%3A%200%3Bmargin%2Dright%3A%2010px%3Bmargin%2Dleft%3A%2010px%3B%20overflow%2Dx%3A%20hidden%3B%7D%2Esidenav%20hr%2Enew1%20%7Bborder%2Dwidth%3A%20thin%3Bborder%2Dcolor%3A%20var%28%2D%2Dmain%2Dlightblue%2Dcolor%29%3Bmargin%2Dright%3A%2010px%3Bmargin%2Dtop%3A%20%2D10px%3B%7D%2Esidenav%20%23sidenav%5Fheader%20%7Bmargin%2Dtop%3A%2010px%3Bborder%3A%201px%3Bcolor%3A%20var%28%2D%2Dmain%2Ddarkblue%2Dcolor%29%3Bborder%2Dcolor%3A%20var%28%2D%2Dmain%2Dlightblue%2Dcolor%29%3B%7D%2Esidenav%20%23sidenav%5Fheader%20img%20%7Bfloat%3A%20left%3B%7D%2Esidenav%20%23sidenav%5Fheader%20a%20%7Bmargin%2Dleft%3A%200px%3Bmargin%2Dright%3A%200px%3Bpadding%2Dleft%3A%200px%3B%7D%2Esidenav%20%23sidenav%5Fheader%20a%3Ahover%20%7Bbackground%2Dsize%3A%20auto%3Bcolor%3A%20%23FFD200%3B%20%7D%2Esidenav%20%23sidenav%5Fheader%20a%3Aactive%20%7B%20%20%7D%2Esidenav%20%3E%20ul%20%7Bbackground%2Dcolor%3A%20rgba%2857%2C%20169%2C%20220%2C%200%2E05%29%3B%20color%3A%20var%28%2D%2Dmain%2Ddarkblue%2Dcolor%29%3Bborder%2Dradius%3A%2010px%3Bpadding%2Dbottom%3A%2010px%3Bpadding%2Dtop%3A%2010px%3Bpadding%2Dright%3A%2010px%3Bmargin%2Dright%3A%2010px%3B%7D%2Esidenav%20a%20%7Bpadding%3A%202px%202px%3Btext%2Ddecoration%3A%20none%3Bfont%2Dsize%3A%20var%28%2D%2Dsidenav%2Dfont%2Dsize%29%3Bdisplay%3Atable%3B%7D%2Esidenav%20%3E%20ul%20%3E%20li%2C%2Esidenav%20%3E%20ul%20%3E%20li%20%3E%20ul%20%3E%20li%20%7B%20padding%2Dright%3A%205px%3Bpadding%2Dleft%3A%205px%3B%7D%2Esidenav%20%3E%20ul%20%3E%20li%20%3E%20a%20%7B%20color%3A%20var%28%2D%2Dmain%2Ddarkblue%2Dcolor%29%3Bfont%2Dweight%3A%20lighter%3B%7D%2Esidenav%20%3E%20ul%20%3E%20li%20%3E%20ul%20%3E%20li%20%3E%20a%20%7B%20color%3A%20var%28%2D%2Dmain%2Ddarkblue%2Dcolor%29%3Bfont%2Dsize%3A%2080%25%3Bpadding%2Dleft%3A%2010px%3Btext%2Dalign%2Dlast%3A%20left%3B%7D%2Esidenav%20%3E%20ul%20%3E%20li%20%3E%20ul%20%3E%20li%20%3E%20ul%20%3E%20li%20%3E%20a%20%7B%20display%3A%20None%3B%7D%2Esidenav%20li%20%7Blist%2Dstyle%2Dtype%3A%20none%3B%7D%2Esidenav%20ul%20%7Bpadding%2Dleft%3A%200px%3B%7D%2Esidenav%20%3E%20ul%20%3E%20li%20%3E%20a%3Ahover%2C%2Esidenav%20%3E%20ul%20%3E%20li%20%3E%20ul%20%3E%20li%20%3E%20a%3Ahover%20%7Bbackground%2Dcolor%3A%20var%28%2D%2Dsecondary%2Dgrey%2Dcolor%2D12%29%3Bbackground%2Dclip%3A%20border%2Dbox%3Bmargin%2Dleft%3A%20%2D10px%3Bpadding%2Dleft%3A%2010px%3B%7D%2Esidenav%20%3E%20ul%20%3E%20li%20%3E%20a%3Ahover%20%7Bpadding%2Dright%3A%2015px%3Bwidth%3A%20230px%3B%09%7D%2Esidenav%20%3E%20ul%20%3E%20li%20%3E%20ul%20%3E%20li%20%3E%20a%3Ahover%20%7Bpadding%2Dright%3A%2010px%3Bwidth%3A%20230px%3B%09%7D%2Esidenav%20%3E%20ul%20%3E%20li%20%3E%20a%3Aactive%20%7B%20color%3A%20%23FFD200%3B%20%7D%2Esidenav%20%3E%20ul%20%3E%20li%20%3E%20ul%20%3E%20li%20%3E%20a%3Aactive%20%7B%20color%3A%20%23FFD200%3B%20%7D%2Esidenav%20code%20%7B%7D%2Esidenav%20%7Bwidth%3A%20280px%3B%7D%23sidenav%20%7Bmargin%2Dleft%3A%20300px%3Bdisplay%3Ablock%3B%7D%2Emarkdown%2Dbody%20%2Eprint%2Dcontents%20%7Bvisibility%3Ahidden%3B%7D%2Emarkdown%2Dbody%20%2Eprint%2Dtoc%2Dtitle%20%7Bvisibility%3Ahidden%3B%7D%2Emarkdown%2Dbody%20%7Bmax%2Dwidth%3A%20980px%3Bmin%2Dwidth%3A%20200px%3Bpadding%3A%2040px%3Bborder%2Dstyle%3A%20solid%3Bborder%2Dstyle%3A%20outset%3Bborder%2Dcolor%3A%20rgba%28104%2C%20167%2C%20238%2C%200%2E089%29%3Bborder%2Dradius%3A%205px%3B%7D%40media%20screen%20and%20%28max%2Dheight%3A%20450px%29%20%7B%2Esidenav%20%7Bpadding%2Dtop%3A%2015px%3B%7D%2Esidenav%20a%20%7Bfont%2Dsize%3A%2018px%3B%7D%23sidenav%20%7Bmargin%2Dleft%3A%2010px%3B%20%7D%2Esidenav%20%7Bvisibility%3Ahidden%3B%7D%2Emarkdown%2Dbody%20%7Bmargin%3A%2010px%3Bpadding%3A%2040px%3Bwidth%3A%20auto%3Bborder%3A%200px%3B%7D%7D%40media%20screen%20and%20%28max%2Dwidth%3A%201024px%29%20%7B%2Esidenav%20%7Bvisibility%3Ahidden%3B%7D%2Emarkdown%2Dbody%20%7Bmargin%3A%2010px%3Bpadding%3A%2040px%3Bwidth%3A%20auto%3Bborder%3A%200px%3B%7D%23sidenav%20%7Bmargin%2Dleft%3A%2010px%3B%7D%7D%40media%20print%20%7B%2Esidenav%20%7Bvisibility%3Ahidden%3B%7D%23sidenav%20%7Bmargin%2Dleft%3A%2010px%3B%7D%2Emarkdown%2Dbody%20%7Bmargin%3A%2010px%3Bpadding%3A%2010px%3Bwidth%3Aauto%3Bborder%3A%200px%3B%7D%40page%20%7Bsize%3A%20A4%3B%20%20margin%3A2cm%3Bpadding%3A2cm%3Bmargin%2Dtop%3A%201cm%3Bpadding%2Dbottom%3A%201cm%3B%7D%2A%20%7Bxbox%2Dsizing%3A%20border%2Dbox%3Bfont%2Dsize%3A90%25%3B%7Da%20%7Bfont%2Dsize%3A%20100%25%3Bcolor%3A%20yellow%3B%7D%2Emarkdown%2Dbody%20article%20%7Bxbox%2Dsizing%3A%20border%2Dbox%3Bfont%2Dsize%3A100%25%3B%7D%2Emarkdown%2Dbody%20p%20%7Bwindows%3A%202%3Borphans%3A%202%3B%7D%2Epagebreakerafter%20%7Bpage%2Dbreak%2Dafter%3A%20always%3Bpadding%2Dtop%3A10mm%3B%7D%2Epagebreakbefore%20%7Bpage%2Dbreak%2Dbefore%3A%20always%3B%7Dh1%2C%20h2%2C%20h3%2C%20h4%20%7Bpage%2Dbreak%2Dafter%3A%20avoid%3B%7Ddiv%2C%20code%2C%20blockquote%2C%20li%2C%20span%2C%20table%2C%20figure%20%7Bpage%2Dbreak%2Dinside%3A%20avoid%3B%7D%7D">
  <!--[if lt IE 9]>
    <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
  <![endif]-->





<link rel="shortcut icon" href="">

</head>



<body>

		<div class="sidenav">
		<div id="sidenav_header">
							<img src="" title="STM32CubeMX.AI logo" align="left" height="70" />
										<br />7.0.0<br />
										<a href="#doc_title"> Command Line Interface </a>
					</div>
		<div id="sidenav_header_button">
			 
							<ul>
					<li><p><a id="index" href="index.html">[ Index ]</a></p></li>
				</ul>
						<hr class="new1">
		</div>	

		<ul>
  <li><a href="#overview">Overview</a>
  <ul>
  <li><a href="#synopsis">Synopsis</a></li>
  <li><a href="#comparison-with-the-x-cube-ai-ui-plug-in-features">Comparison with the X-CUBE-AI UI plug-in features</a></li>
  <li><a href="#command-work-flow">Command work-flow</a></li>
  <li><a href="#enable-automl-pipeline-for-resource-constrained-environment">Enable AutoML pipeline for resource-constrained environment</a></li>
  <li><a href="#error-handling">Error handling</a></li>
  </ul></li>
  <li><a href="#common-arguments">Common arguments</a></li>
  <li><a href="#analyze-command">Analyze command</a>
  <ul>
  <li><a href="#description">Description</a></li>
  <li><a href="#specific-arguments">Specific arguments</a></li>
  <li><a href="#examples">Examples</a></li>
  <li><a href="#dl-framework-detection">DL framework detection</a></li>
  <li><a href="#out-of-the-box-information">Out-of-the-box information</a></li>
  <li><a href="#ir-graph-description">IR graph description</a></li>
  <li><a href="#complexity-report-per-layer">Complexity report per layer</a></li>
  <li><a href="#c-graph-description">C-graph description</a></li>
  </ul></li>
  <li><a href="#validate-command">Validate command</a>
  <ul>
  <li><a href="#description-1">Description</a></li>
  <li><a href="#specific-arguments-1">Specific arguments</a></li>
  <li><a href="#examples-1">Examples</a></li>
  <li><a href="#serial-com-port-configuration">Serial COM port configuration</a></li>
  <li><a href="#ref_complexity_per_layer">Extended complexity report per layer</a></li>
  <li><a href="#execution-time-per-layer">Execution time per layer</a></li>
  </ul></li>
  <li><a href="#generate-command">Generate command</a>
  <ul>
  <li><a href="#description-2">Description</a></li>
  <li><a href="#specific-arguments-2">Specific arguments</a></li>
  <li><a href="#examples-2">Examples</a></li>
  <li><a href="#ref_addr_options">Particular network data c-file</a></li>
  <li><a href="#update_c_files">Update an ioc-based project</a></li>
  <li><a href="#update-a-proprietary-source-tree">Update a proprietary source tree</a></li>
  </ul></li>
  <li><a href="#supported-ops-command">Supported-ops command</a>
  <ul>
  <li><a href="#description-3">Description</a></li>
  <li><a href="#specific-arguments-3">Specific arguments</a></li>
  <li><a href="#examples-3">Examples</a></li>
  </ul></li>
  <li><a href="#references">References</a></li>
  </ul>
	</div>
	<article id="sidenav" class="markdown-body">
		



<header>
<section class="st_header" id="doc_title">

<div class="himage">
	<img src="" title="STM32CubeMX.AI" align="right" height="70" />
	<img src="" title="STM32" align="right" height="90" />
</div>

<h1 class="title followed-by-subtitle">Command Line Interface</h1>

	<p class="subtitle">X-CUBE-AI Expansion Package</p>

	<div class="revision">r4.0</div>

	<div class="ai_platform">
		AI PLATFORM r7.0.0
					(Embedded Inference Client API 1.1.0)
			</div>
			Command Line Interface r1.5.1
	




</section>
</header>
 




<section id="overview" class="level1">
<h1>Overview</h1>
<p>The stm32ai application is a console utility which provides a complete and unified <em>Command Line Interface</em> (CLI) to generate from a pre-trained DL/ML model, an optimized library for STM32 device family. It consists on three main commands: <a href="#analyze-command"><strong>analyze</strong></a>, <a href="#validate-command"><strong>validate</strong></a> and <a href="#generate-command"><strong>generate</strong></a>. Each command can be used independently of the other with the same set of <a href="#common-arguments">common options</a> (model files, compression factor, output directory…) and specific options. The <a href="quantization.html#ref_quantize_cmd"><strong>quantize</strong></a> command is a specific command to apply a post-training quantization process (refer to <a href="quantization.html">[QUANT]</a>). The <a href="#supported-ops-command"><strong>supported-ops</strong></a> allows to list the supported operators and associated constraints for a given deep learning framework.</p>
<section id="synopsis" class="level2">
<h2>Synopsis</h2>
<hr />
<div class="sourceCode" id="cb1"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>Neural Network Tools <span class="kw">for</span> STM32AI v1<span class="op">.</span><span class="fu">5</span><span class="op">.</span><span class="fu">1</span> <span class="op">(</span>STM<span class="op">.</span><span class="fu">ai</span> v7<span class="op">.</span><span class="fu">0</span><span class="op">.</span><span class="fu">0</span><span class="op">)</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a>usage<span class="op">:</span> stm32ai<span class="op">.</span><span class="fu">py</span> <span class="op">[-</span>h<span class="op">]</span> <span class="op">[--</span>version<span class="op">]</span> <span class="op">[--</span>tools<span class="op">-</span>version<span class="op">]</span> <span class="op">[--</span>model FILE<span class="op">]</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a>                  <span class="op">[--</span>verbosity <span class="op">[{</span>0<span class="op">,</span>1<span class="op">,</span>2<span class="op">}]]</span> <span class="op">[--</span>type <span class="op">[</span>keras<span class="op">|</span>onnx<span class="op">|</span>tflite<span class="op">]]</span></span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a>                  <span class="op">[--</span>name STR<span class="op">]</span> <span class="op">[--</span>compression <span class="op">[</span>1<span class="op">|</span>4<span class="op">|</span>8<span class="op">]]</span> <span class="op">[--</span>quantize <span class="op">[</span>FILE<span class="op">]]</span></span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a>                  <span class="op">[--</span>custom FILE<span class="op">]</span> <span class="op">[--</span>allocate<span class="op">-</span>inputs<span class="op">]</span> <span class="op">[--</span>allocate<span class="op">-</span>outputs<span class="op">]</span></span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a>                  <span class="op">[--</span>workspace <span class="fu">DIR</span><span class="op">]</span> <span class="op">[--</span>output <span class="fu">DIR</span><span class="op">]</span> <span class="op">[--</span>split<span class="op">-</span>weights<span class="op">]</span></span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a>                  <span class="op">[--</span>no<span class="op">-</span>onnx<span class="op">-</span>optimizer<span class="op">]</span> <span class="op">[--</span>no<span class="op">-</span>onnx<span class="op">-</span>io<span class="op">-</span>transpose<span class="op">]</span></span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a>                  <span class="op">[--</span>prefetch<span class="op">-</span>compressed<span class="op">-</span>weights<span class="op">]</span> <span class="op">[--</span>binary<span class="op">]</span> <span class="op">[--</span>dll<span class="op">]</span> <span class="op">[--</span>ihex<span class="op">]</span></span>
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a>                  <span class="op">[--</span>address ADDR<span class="op">]</span> <span class="op">[--</span>copy<span class="op">-</span>weights<span class="op">-</span>at ADDR<span class="op">]</span> <span class="op">[--</span>relocatable<span class="op">]</span></span>
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a>                  <span class="op">[--</span>lib <span class="fu">DIR</span><span class="op">]</span> <span class="op">[--</span>series STR<span class="op">]</span> <span class="op">[--</span>no<span class="op">-</span>c<span class="op">-</span>files<span class="op">]</span> <span class="op">[--</span>batch<span class="op">-</span>size <span class="dt">INT</span><span class="op">]</span></span>
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a>                  <span class="op">[--</span>mode MODE<span class="op">]</span> <span class="op">[--</span>desc DESC<span class="op">]</span> <span class="op">[--</span>valinput FILE <span class="op">[</span>FILE <span class="op">...]]</span></span>
<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a>                  <span class="op">[--</span>valoutput FILE <span class="op">[</span>FILE <span class="op">...]]</span> <span class="op">[--</span>range RANGE RANGE<span class="op">]</span> <span class="op">[--</span>full<span class="op">]</span></span>
<span id="cb1-13"><a href="#cb1-13" aria-hidden="true" tabindex="-1"></a>                  <span class="op">[--</span>save<span class="op">-</span>csv<span class="op">]</span> <span class="op">[--</span>classifier<span class="op">]</span> <span class="op">[--</span>no<span class="op">-</span>check<span class="op">]</span> <span class="op">[--</span>no<span class="op">-</span>exec<span class="op">-</span>model<span class="op">]</span></span>
<span id="cb1-14"><a href="#cb1-14" aria-hidden="true" tabindex="-1"></a>                  <span class="op">[--</span>seed SEED<span class="op">]</span> <span class="op">[--</span>with<span class="op">-</span>report<span class="op">]</span></span>
<span id="cb1-15"><a href="#cb1-15" aria-hidden="true" tabindex="-1"></a>                  analyze<span class="op">|</span>generate<span class="op">|</span>validate<span class="op">|</span>quantize<span class="op">|</span>supported<span class="op">-</span>ops</span></code></pre></div>
<hr />
<p>Short description can be displayed with the following command:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai <span class="op">--</span>help</span></code></pre></div>
<div class="HTips">
<p><strong>Note</strong> — In this article, <strong><em>Netron</em></strong> application (<a href="https://github.com/lutzroeder/netron">https://github.com/lutzroeder/netron</a>) is used to visualize the original neural network model.</p>
</div>
</section>
<section id="comparison-with-the-x-cube-ai-ui-plug-in-features" class="level2">
<h2>Comparison with the X-CUBE-AI UI plug-in features</h2>
<p>The stm32ai application is used as back-end by the X-CUBE-AI UI plug-in (refer to <a href="https://www.st.com/resource/en/user_manual/dm00570145.pdf">[UM]</a>).</p>
<div id="fig:cli_in_ui" class="fignos">
<figure>
<img src="" property="center" style="width:95.0%" alt="Figure 1: CLI as back-end" /><figcaption aria-hidden="true"><span>Figure 1:</span> CLI as back-end</figcaption>
</figure>
</div>
<p>In comparison with the X-CUBE-AI UI plug-in, the following high-level features are not supported:</p>
<ul>
<li>extra C-code wrapper to manage multiple models. CLI manages only one model at the time.<br />
</li>
<li>creation of a whole IDE project including the optimized inference runtime library, AI headers files and the C-files related to the HW settings. CLI can be only used to generate the specialized NN C-files. However, it allows to update an initial IDE project, STM32CubeMX-based or proprietary source tree (see <a href="#update-an-ioc-based-project">“Update an ioc-based project”</a> section).<br />
</li>
<li>the check to know if a model will fit, in term of memory layout in a selected STM32 memory device. CLI reports (see <a href="#analyze-command">analyze</a> command) only the main system level dimensioning metrics: ROM, RAM, MACC.. (refer to <a href="evaluation_metrics.html">[METRIC]</a> for details)</li>
<li>for the “<em>Validation process on target</em>”, as a full STM32 project is expected, it must be generated previously through the UI. Note that this project can be updated later (see <a href="#update-an-ioc-based-project">“Update an ioc-based project”</a> section). “<em>Validation process on desktop</em>” is fully supported through the CLI without restriction.</li>
<li>graphic visualization of the generated c-graph (including the usage of the RAM). CLI provides only a textual representation (table form) of the c-graph including a description of the tensors/operators (see <a href="#analyze-command">analyze</a> command).</li>
</ul>
</section>
<section id="command-work-flow" class="level2">
<h2>Command work-flow</h2>
<p>For each command, the same preliminary steps are applied. A report (txt file) is systematically created and fully or partially displayed. Additional JSON files (dictionary based) are generated in the workspace directory to be parsed by the X-CUBE-AI plug-in to retrieve the results. Note that they can be also used by a non-regression environment. The format of these files is out of the scope of this document.</p>
<pre><code>&lt;workspace-directory-path&gt;\&lt;name&gt;_report.json, &lt;name&gt;_c_graph.json
&lt;output-directory-path&gt;\&lt;name&gt;_&lt;cmd_name&gt;_report.txt</code></pre>
<ul>
<li><code>&#39;analyze&#39;</code> flow
<ul>
<li>import the model<br />
</li>
<li>map, render and optimize internally the model</li>
<li>log and display a report</li>
</ul></li>
<li><code>&#39;validate&#39;</code> flow
<ul>
<li>import the model<br />
</li>
<li>map, render and optimize internally the model</li>
<li>execute the generated C-model (on desktop or from the STM32 target)<br />
</li>
<li>execute the original model using original deep learning runtime framework for x86</li>
<li>evaluate the metrics</li>
<li>log and display a report</li>
</ul></li>
<li><code>&#39;generate&#39;</code> flow
<ul>
<li>import the model<br />
</li>
<li>map, render and optimize internally the model</li>
<li>export the specialized C-files</li>
<li>log and display a report</li>
</ul></li>
</ul>
</section>
<section id="enable-automl-pipeline-for-resource-constrained-environment" class="level2">
<h2>Enable AutoML pipeline for resource-constrained environment</h2>
<p>CLI can be integrated in an automatic or manual pipeline, to design a deployable and effective neural network architectures for resource-constrained environment (i.e. with low memory/computational resources and/or critical power consumption budgets). The main loop can be extended with a post-analyzing/validating steps of the pre-trained model candidates to check and to take into account the end-user target constraints thanks to the respective <a href="#analyze-command">analyze</a> and <a href="#validate-command">validate</a> commands.</p>
<div id="fig:auto_ml" class="fignos">
<figure>
<img src="" property="center" style="width:95.0%" alt="Figure 2: Possible AutoML flow with post deployment check" /><figcaption aria-hidden="true"><span>Figure 2:</span> Possible AutoML flow with post deployment check</figcaption>
</figure>
</div>
<ul>
<li>checking of the budgeted memory (ROM/RAM) can be done in the inner (topology selection/definition) before the time-consuming training process (or re-training process) to pre-constraint the choices of the neural network architecture according the memory budgets.</li>
<li>note that the “analyze” and “X86 validate” step can be merged, “analyze” information are also available in the “validate” reports.</li>
</ul>
</section>
<section id="error-handling" class="level2">
<h2>Error handling</h2>
<p>During the execution of a given command, after the parsing of the arguments if an error is raised, the stm32ai application returns <code>-1</code> (else <code>0</code> is returned).</p>
<p>An error message is prefixed by a category and a short description.</p>
<table>
<colgroup>
<col style="width: 41%" />
<col style="width: 58%" />
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">category</th>
<th style="text-align: left;">description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">CLI ERROR</td>
<td style="text-align: left;">specific STM.ai/CLI error</td>
</tr>
<tr class="even">
<td style="text-align: left;">LOAD ERROR</td>
<td style="text-align: left;">error during the load/import of the model or the connection with the STM32 board - OSError, IOError</td>
</tr>
<tr class="odd">
<td style="text-align: left;">NOT IMPLEMENTED</td>
<td style="text-align: left;">expected feature is not implemented - NotImplementedError</td>
</tr>
<tr class="even">
<td style="text-align: left;">INTERRUPT</td>
<td style="text-align: left;">indicates that the execution of the command has been interrupted by the user (<code>CTRL-C</code> or kill system signal) - KeyboardInterrupt, SystemExit</td>
</tr>
<tr class="odd">
<td style="text-align: left;">TOOLS ERROR, INTERNAL ERROR</td>
<td style="text-align: left;">internal error - ImportError, RuntimeError, ValueError</td>
</tr>
</tbody>
</table>
<div class="Alert">
<p><strong>Warning</strong> — There is a specific attention to have explicit and relevant short description of the error messages. Unfortunately, this is not always case, additional TIPS and TRICKS can be found in the <a href="faq_generic.html">FAQ</a> article or don’t hesitate to use the <a href="https://community.st.com/s/topic/0TO0X0000003iUqWAI/stm32-machine-learning-ai">ST Community channel/forum</a> or local support.</p>
</div>
<p><strong>Example of specific error</strong></p>
<div class="sourceCode" id="cb4"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai validate model<span class="op">.</span><span class="fu">tflite</span> <span class="op">-</span>t keras</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a>Neural Network Tools <span class="kw">for</span> STM32AI v1<span class="op">.</span><span class="fu">5</span><span class="op">.</span><span class="fu">1</span> <span class="op">(</span>STM<span class="op">.</span><span class="fu">ai</span> v7<span class="op">.</span><span class="fu">0</span><span class="op">.</span><span class="fu">0</span><span class="op">)</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a>E102<span class="op">(</span>CliArgumentError<span class="op">):</span> Wrong model files <span class="kw">for</span> &#39;keras&#39;</span></code></pre></div>
</section>
</section>
<section id="common-arguments" class="level1">
<h1>Common arguments</h1>
<p>Following table describes the common arguments for the <a href="#analyze-command">analyze</a>, <a href="#validate-command">validate</a> and <a href="#generate-command">generate</a> commands. The specific arguments are described in the respective command section.</p>
<table>
<colgroup>
<col style="width: 26%" />
<col style="width: 73%" />
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">parameter</th>
<th style="text-align: left;">description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;"><code>-m/--model</code></td>
<td style="text-align: left;">indicates the original model file paths (see <a href="#dl-framework-detection">“DL framework detection”</a> section) - <em>Mandatory</em></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>-t/--type</code></td>
<td style="text-align: left;">indicates the type of original DL framework when it can be not inferred by the extensions of the model files (see <a href="#dl-framework-detection">“DL framework detection”</a> section) - <em>Optional</em></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>-w/--workspace</code></td>
<td style="text-align: left;">indicates a working/temporary directory for the intermediate/temporary files (default:<code>&quot;./stm32ai_ws/&quot;</code> directory) - <em>Optional</em></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>-o/--output</code></td>
<td style="text-align: left;">indicates the output directory for the generated C-files and report files (default:<code>&quot;./stm32ai_output/&quot;</code>directory) - <em>Optional</em></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>-n/--name</code></td>
<td style="text-align: left;">indicates the C-name (<code>C-string</code> type) for the imported model. Used to prefix the name of specialized NN C-files and the API functions. Also used for the temporary files, this allows to use the same workspace/output directories for different models (default: <code>&quot;network&quot;</code>). - <em>Optional</em></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>-c/--compression</code></td>
<td style="text-align: left;">indicates the expected global factor of compression which will be applied. Supported values: <code>1|4|8</code> (default: ‘1’). Refer to <a href="https://www.st.com/resource/en/user_manual/dm00570145.pdf">[UM], “Graph flow and memory layout optimizer”</a> section. Compression can be only performed on the dense-type layer in float. - <em>Optional</em></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>--allocate-inputs</code></td>
<td style="text-align: left;">if defined, this flag indicates that the “activations” buffer will be also used to handle the input buffers else, default behavior, they should be allocated separately in the user memory space. Depending on the size of the input data, the “activations” buffer may be bigger but overall less than the sum of the activation buffer plus the input buffer. To retrieve the address of the associated input buffers (refer to <a href="embedded_client_api.html">[API], “IO buffers into activations buffer”</a> section). - <em>Optional</em></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>--allocate-outputs</code></td>
<td style="text-align: left;">if defined, this flag indicates that the “activations” buffer will be also used to handle the outputs buffers, else default behavior, they should be allocated separately in the user memory space. (refer to <a href="embedded_client_api.html">[API], “IO buffers into activations buffer”</a> section). - <em>Optional</em></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>--split-weights</code></td>
<td style="text-align: left;">if defined, this flag indicates that one c-array is generated by weights/bias data tensor instead to have an unique C-array (“weights” buffer) for the whole (default: disabled), (refer to <a href="embedded_client_api.html#ref_split_weights">[API], “Split weights buffer”</a> section) - <em>Optional</em></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>-q/--quantize</code></td>
<td style="text-align: left;">indicates file path of the <em>tensor format configuration</em> file for a Keras model or for the configuration file to perform the Keras post-training quantization process. (refer to <a href="quantization.html">[QUANT]</a>) - <em>Optional</em></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>--custom</code></td>
<td style="text-align: left;">indicates file path of the configuration file (json file) to support the custom layers (refer to <a href="keras_lambda_custom.html">[CUST]</a>) - <em>Optional</em></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>-v/--verbosity</code></td>
<td style="text-align: left;">indicates the level of verbosity (or level of displayed information). Supported values: 0,1,2 (default:<code>1</code>) - <em>Optional</em></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>--no-onnx-io-transpose</code></td>
<td style="text-align: left;">if defined this flag can be used to avoid to add a specific IO transpose layer if necessary during the import of a ONNX model (see <a href="faq_generic.html#onnx_channel_first">“Channel first support for ONNX model”</a> section) - <em>Optional</em></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>--no-onnx-optimizer</code></td>
<td style="text-align: left;">if defined this flag allows to disable the ONNX optimizer pass - <em>Optional</em></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>--prefetch-compressed-weights</code></td>
<td style="text-align: left;">if defined this flag allows to enable a prefetch mechanism to load the compressed weights (only for the floating point fully-connected or dense layers - <em>Optional</em></td>
</tr>
</tbody>
</table>
</section>
<section id="analyze-command" class="level1">
<h1>Analyze command</h1>
<section id="description" class="level2">
<h2>Description</h2>
<p>The <code>&#39;analyze&#39;</code> command is the primary command to import, to parse, to check and to render an uploaded pre-trained model. <a href="#out-of-the-box-information">Detailed report</a> provides the main system metrics to know if the generated code can be deployed on a STM32 device. It includes also rendering information by layer or/and operator (see <a href="#c-graph-description">“C-graph description”</a> section). After completion, the user can be fully <em>confident</em> on the imported model in term of supported layer/operators.</p>
</section>
<section id="specific-arguments" class="level2">
<h2>Specific arguments</h2>
<p>Only the <a href="#common-arguments">“Common”</a> arguments are considered.</p>
</section>
<section id="examples" class="level2">
<h2>Examples</h2>
<ul>
<li><p>Analyze a model (simple model file)</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai analyze <span class="op">-</span>m <span class="op">&lt;</span>model_file_path<span class="op">&gt;</span></span></code></pre></div></li>
<li><p>Analyze a 32b float model with compression request</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai analyze <span class="op">-</span>m <span class="op">&lt;</span>model_file_path<span class="op">&gt;</span> <span class="op">-</span>c 8</span></code></pre></div></li>
<li><p>Analyze a model with input tensors placed in activations buffer</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai analyze <span class="op">-</span>m <span class="op">&lt;</span>model_file_path<span class="op">&gt;</span> <span class="op">--</span>allocate<span class="op">-</span>inputs</span></code></pre></div></li>
<li><p>Analyze a Keras post-quantized model (refer to <a href="quantization.html">[QUANT]</a>)</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai analyze <span class="op">-</span>m <span class="op">&lt;</span>modified_model_file<span class="op">&gt;.</span><span class="fu">h5</span> <span class="op">-</span>q <span class="op">&lt;</span>quant_file_desc<span class="op">&gt;.</span><span class="fu">json</span></span></code></pre></div></li>
</ul>
</section>
<section id="dl-framework-detection" class="level2">
<h2>DL framework detection</h2>
<p>Extension of the model files are used to identify the DL framework which should be used to import the model. If the auto-detection is ambiguous, the <code>&#39;--type/-t&#39;</code> option should be used to define the correct framework.</p>
<table>
<thead>
<tr class="header">
<th style="text-align: left;">DL framework</th>
<th style="text-align: left;">type (–type/-t)</th>
<th style="text-align: left;">file extension</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">Keras</td>
<td style="text-align: left;"><code>keras</code></td>
<td style="text-align: left;"><code>.h5</code> or <code>.hdf5</code> and <code>.json</code> or <code>.yml</code> or <code>yaml</code></td>
</tr>
<tr class="even">
<td style="text-align: left;">TensorFlow lite</td>
<td style="text-align: left;"><code>tflite</code></td>
<td style="text-align: left;"><code>.tflite</code></td>
</tr>
<tr class="odd">
<td style="text-align: left;">ONNX</td>
<td style="text-align: left;"><code>onnx</code></td>
<td style="text-align: left;"><code>.onnx</code></td>
</tr>
</tbody>
</table>
</section>
<section id="out-of-the-box-information" class="level2">
<h2>Out-of-the-box information</h2>
<p>The first part of the log shows the used arguments and the main system dimensioning C-model properties.</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai analyze <span class="op">-</span>m ds_cnn<span class="op">.</span><span class="fu">h5</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a>Neural Network Tools <span class="kw">for</span> STM32AI v1<span class="op">.</span><span class="fu">5</span><span class="op">.</span><span class="fu">1</span> <span class="op">(</span>STM<span class="op">.</span><span class="fu">ai</span> v7<span class="op">.</span><span class="fu">0</span><span class="op">.</span><span class="fu">0</span><span class="op">)</span></span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a> Exec<span class="op">/</span>report summary <span class="op">(</span>analyze<span class="op">)</span></span>
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a> <span class="op">-----------------------------------------------------------------------------</span></span>
<span id="cb9-6"><a href="#cb9-6" aria-hidden="true" tabindex="-1"></a> model file         <span class="op">:</span> <span class="op">&lt;</span>model<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\ds_cnn<span class="op">.</span><span class="fu">h5</span></span>
<span id="cb9-7"><a href="#cb9-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">type</span>               <span class="op">:</span> keras</span>
<span id="cb9-8"><a href="#cb9-8" aria-hidden="true" tabindex="-1"></a> c_name             <span class="op">:</span> network</span>
<span id="cb9-9"><a href="#cb9-9" aria-hidden="true" tabindex="-1"></a> workspace <span class="fu">dir</span>      <span class="op">:</span> <span class="op">&lt;</span>workspace<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span></span>
<span id="cb9-10"><a href="#cb9-10" aria-hidden="true" tabindex="-1"></a> output <span class="fu">dir</span>         <span class="op">:</span> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span></span>
<span id="cb9-11"><a href="#cb9-11" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-12"><a href="#cb9-12" aria-hidden="true" tabindex="-1"></a> model_name         <span class="op">:</span> ds_cnn</span>
<span id="cb9-13"><a href="#cb9-13" aria-hidden="true" tabindex="-1"></a> model_hash         <span class="op">:</span> cea66c686b2a1529d82848dc1fd0d873</span>
<span id="cb9-14"><a href="#cb9-14" aria-hidden="true" tabindex="-1"></a> input              <span class="op">:</span> input_0 <span class="op">[</span>490 items<span class="op">,</span> 1<span class="op">.</span><span class="fu">91</span> KiB<span class="op">,</span> ai_float<span class="op">,</span> FLOAT32<span class="op">,</span> <span class="op">(</span>49<span class="op">,</span> 10<span class="op">,</span> 1<span class="op">)]</span></span>
<span id="cb9-15"><a href="#cb9-15" aria-hidden="true" tabindex="-1"></a> inputs <span class="op">(</span>total<span class="op">)</span>     <span class="op">:</span> 1<span class="op">.</span><span class="fu">91</span> KiB</span>
<span id="cb9-16"><a href="#cb9-16" aria-hidden="true" tabindex="-1"></a> output             <span class="op">:</span> dense_1_nl <span class="op">[</span>12 items<span class="op">,</span> 48 B<span class="op">,</span> ai_float<span class="op">,</span> FLOAT32<span class="op">,</span> <span class="op">(</span>1<span class="op">,</span> 1<span class="op">,</span> 12<span class="op">)]</span></span>
<span id="cb9-17"><a href="#cb9-17" aria-hidden="true" tabindex="-1"></a> outputs <span class="op">(</span>total<span class="op">)</span>    <span class="op">:</span> 48 B</span>
<span id="cb9-18"><a href="#cb9-18" aria-hidden="true" tabindex="-1"></a> params <span class="co">#           : 40,140 items (156.80 KiB)</span></span>
<span id="cb9-19"><a href="#cb9-19" aria-hidden="true" tabindex="-1"></a> macc               <span class="op">:</span> 4<span class="op">,</span>833<span class="op">,</span>536</span>
<span id="cb9-20"><a href="#cb9-20" aria-hidden="true" tabindex="-1"></a> weights <span class="op">(</span>ro<span class="op">)</span>       <span class="op">:</span> 159<span class="op">,</span>536 B <span class="op">(</span>155<span class="op">.</span><span class="fu">80</span> KiB<span class="op">)</span> <span class="op">/</span> <span class="op">-</span>1<span class="op">,</span>024<span class="op">(-</span>0<span class="op">.</span><span class="fu">6</span><span class="op">%)</span> vs original model</span>
<span id="cb9-21"><a href="#cb9-21" aria-hidden="true" tabindex="-1"></a> activations <span class="op">(</span>rw<span class="op">)</span>   <span class="op">:</span> 57<span class="op">,</span>600 B <span class="op">(</span>56<span class="op">.</span><span class="fu">25</span> KiB<span class="op">)</span></span>
<span id="cb9-22"><a href="#cb9-22" aria-hidden="true" tabindex="-1"></a> ram <span class="op">(</span>total<span class="op">)</span>        <span class="op">:</span> 59<span class="op">,</span>608 B <span class="op">(</span>58<span class="op">.</span><span class="fu">21</span> KiB<span class="op">)</span> <span class="op">=</span> 57<span class="op">,</span>600 <span class="op">+</span> 1<span class="op">,</span>960 <span class="op">+</span> 48</span>
<span id="cb9-23"><a href="#cb9-23" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span></code></pre></div>
<p>Initial sub-section recalls the CLI arguments. Note that the full raw command line is saved at the beginning of the generated report file: <code>&lt;output-directory-path&gt;\network_&lt;cmd&gt;_report.txt</code></p>
<table>
<colgroup>
<col style="width: 21%" />
<col style="width: 78%" />
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">field</th>
<th style="text-align: left;">description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">model file</td>
<td style="text-align: left;">reports the full-path of the original model files (<code>--model</code>). If multiple files, there is one line by file.</td>
</tr>
<tr class="even">
<td style="text-align: left;">type</td>
<td style="text-align: left;">reports the <code>--type</code> value or inferred DL framework type</td>
</tr>
<tr class="odd">
<td style="text-align: left;">c_name</td>
<td style="text-align: left;">reports the expected C-name for the generated C-model (<code>--name</code>)</td>
</tr>
<tr class="even">
<td style="text-align: left;">compression</td>
<td style="text-align: left;">reports the expected compression factor (<code>--compression</code>)</td>
</tr>
<tr class="odd">
<td style="text-align: left;">quantize</td>
<td style="text-align: left;">reports the quantization parameter</td>
</tr>
<tr class="even">
<td style="text-align: left;">workspace dir</td>
<td style="text-align: left;">full-path of the workspace directory (<code>--workspace</code>)</td>
</tr>
<tr class="odd">
<td style="text-align: left;">output dir</td>
<td style="text-align: left;">full-path of the output directory (<code>--output</code>)</td>
</tr>
</tbody>
</table>
<p>The second part shows the results of the importing and rendering stages.</p>
<table>
<colgroup>
<col style="width: 16%" />
<col style="width: 83%" />
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">field</th>
<th style="text-align: left;">description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">model_name</td>
<td style="text-align: left;">designates the name of the provided model. This is generally the name of the model file.</td>
</tr>
<tr class="even">
<td style="text-align: left;">model_hash</td>
<td style="text-align: left;">provides a calculated MD5 signature of the imported model files.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">input</td>
<td style="text-align: left;">indicates the name, the item number, the format and the size in bytes of an input tensor. There is one line by input. <code>&#39;input (total)&#39;</code> field indicates the total size (in bytes) of the inputs.</td>
</tr>
<tr class="even">
<td style="text-align: left;">output</td>
<td style="text-align: left;">indicates the name, the format and the size of the output tensor. There is one line by output. <code>output (total)</code> field indicates the total size (in bytes) of the outputs.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">param #</td>
<td style="text-align: left;">indicates the total number of parameters of the original model and associated size in bytes.</td>
</tr>
<tr class="even">
<td style="text-align: left;">macc</td>
<td style="text-align: left;">indicates the whole computational complexity of the original model. Value is defined in <code>MACC</code> operations: Multiply-ACCumulated operations, refer to <a href="evaluation_metrics.html#ref_memory_occupancy">[METRIC]</a></td>
</tr>
<tr class="odd">
<td style="text-align: left;">weights (ro)</td>
<td style="text-align: left;">indicates the requested size (in bytes) for the generated constant RO parameters (bias and weights tensors). Size is 4-bytes aligned. If the value is different from the original model files, the ratio is also reported. (refer to <a href="evaluation_metrics.html#ref_memory_occupancy">[METRIC], “Memory-related metrics”</a> section)</td>
</tr>
<tr class="even">
<td style="text-align: left;">activations (rw)</td>
<td style="text-align: left;">indicates the requested size (in bytes) for the working RW memory buffer (also called activations buffer). It is mainly used as <em>internal heap</em> for the activations and temporary results. (refer to <a href="evaluation_metrics.html#ref_memory_occupancy">[METRIC], “Memory-related metrics”</a> section)</td>
</tr>
<tr class="odd">
<td style="text-align: left;">ram (total)</td>
<td style="text-align: left;">indicates the requested total size (in bytes) for the RAM including the input and output buffers.</td>
</tr>
</tbody>
</table>
<p><strong>Example of ‘output’</strong></p>
<pre><code>  input_0 [490 items, 1.91 KiB, ai_float, FLOAT32, (49, 10, 1)]</code></pre>
<ul>
<li>indicates that <code>input_0</code> tensor has a size of 490 floating-point items (size in bytes = <code>490 x 4B = 1.91KiB</code>) with a <code>(49, 10, 1)</code> shape. (refer to <a href="embedded_client_api.html">[API] “IO tensor”</a> section)</li>
</ul>
<section id="compressed-floating-point-model-example" class="level3 unnumbered">
<h3 class="unnumbered">Compressed floating point model example</h3>
<p>For a <em>“compressed”</em> floating point model, the compression gain for the <code>&#39;weights&#39;</code> size, here <em>-72.90%</em> is the global difference between the original 32b float model and the generated <em>“compressed”</em> C-model. <em>Note that only the full-connected or dense layers can be compressed.</em></p>
<div class="sourceCode" id="cb11"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai analyze <span class="op">-</span>m dnn<span class="op">.</span><span class="fu">h5</span> <span class="op">-</span>c 4</span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a> input              <span class="op">:</span> input_0 <span class="op">[</span>490 items<span class="op">,</span> 1<span class="op">.</span><span class="fu">91</span> KiB<span class="op">,</span> ai_float<span class="op">,</span> FLOAT32<span class="op">,</span> <span class="op">(</span>1<span class="op">,</span> 1<span class="op">,</span> 490<span class="op">)]</span></span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a> inputs <span class="op">(</span>total<span class="op">)</span>     <span class="op">:</span> 1<span class="op">.</span><span class="fu">91</span> KiB</span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a> output             <span class="op">:</span> dense_4_nl <span class="op">[</span>12 items<span class="op">,</span> 48 B<span class="op">,</span> ai_float<span class="op">,</span> FLOAT32<span class="op">,</span> <span class="op">(</span>1<span class="op">,</span> 1<span class="op">,</span> 12<span class="op">)]</span></span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a> outputs <span class="op">(</span>total<span class="op">)</span>    <span class="op">:</span> 48 B</span>
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a> params <span class="co">#           : 114,204 items (446.11 KiB)</span></span>
<span id="cb11-8"><a href="#cb11-8" aria-hidden="true" tabindex="-1"></a> macc               <span class="op">:</span> 114<span class="op">,</span>816</span>
<span id="cb11-9"><a href="#cb11-9" aria-hidden="true" tabindex="-1"></a> weights <span class="op">(</span>ro<span class="op">)</span>       <span class="op">:</span> 123<span class="op">,</span>792 B <span class="op">(</span>120<span class="op">.</span><span class="fu">89</span> KiB<span class="op">)</span> <span class="op">-</span>333<span class="op">,</span>024<span class="op">(-</span>72<span class="op">.</span><span class="fu">9</span><span class="op">%)</span></span>
<span id="cb11-10"><a href="#cb11-10" aria-hidden="true" tabindex="-1"></a> activations <span class="op">(</span>rw<span class="op">)</span>   <span class="op">:</span> 1<span class="op">,</span>152 B <span class="op">(</span>1<span class="op">.</span><span class="fu">12</span> KiB<span class="op">)</span></span>
<span id="cb11-11"><a href="#cb11-11" aria-hidden="true" tabindex="-1"></a> ram <span class="op">(</span>total<span class="op">)</span>        <span class="op">:</span> 3<span class="op">,</span>160 B <span class="op">(</span>3<span class="op">.</span><span class="fu">09</span> KiB<span class="op">)</span> <span class="op">=</span> 1<span class="op">,</span>152 <span class="op">+</span> 1<span class="op">,</span>960 <span class="op">+</span> 48</span>
<span id="cb11-12"><a href="#cb11-12" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span></code></pre></div>
</section>
<section id="quantized-tflite-model-example---integer-format" class="level3 unnumbered">
<h3 class="unnumbered">Quantized TFLite model example - integer format</h3>
<p>Following report shows the case where a TensorFlow lite quantized model is imported and the inputs are placed in the activations buffer. In this case as the parameters from the imported file are already quantized (8-b format), no gain of <code>weights</code> size is reported. Note that for each input (or output), type/scale and zero-point value are reported. Additional info are displayed in the <a href="#ir-graph-description">“IR Graph description”</a> section.</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai analyze <span class="op">-</span>m <span class="op">&lt;</span>quantized_model_file<span class="op">&gt;.</span><span class="fu">tflite</span> <span class="op">--</span>allocate<span class="op">-</span>inputs</span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a> input              <span class="op">:</span> Reshape_1 <span class="op">[</span>1960 items<span class="op">,</span> 1<span class="op">.</span><span class="fu">91</span> KiB<span class="op">,</span> ai_u8<span class="op">,</span> scale<span class="op">=</span>0<span class="op">.</span><span class="fu">10196</span><span class="op">,</span> zero_point<span class="op">=</span>0<span class="op">,</span> <span class="op">(</span>49<span class="op">,</span> 40<span class="op">,</span> 1<span class="op">)]</span></span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a> inputs <span class="op">(</span>total<span class="op">)</span>     <span class="op">:</span> 1<span class="op">.</span><span class="fu">91</span> KiB</span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a> output             <span class="op">:</span> nl_2_fmt <span class="op">[</span>4 items<span class="op">,</span> 4 B<span class="op">,</span> ai_u8<span class="op">,</span> scale<span class="op">=</span>0<span class="op">.</span><span class="fu">00390625</span><span class="op">,</span> zero_point<span class="op">=</span>0<span class="op">,</span> <span class="op">(</span>1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">)]</span></span>
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true" tabindex="-1"></a> outputs <span class="op">(</span>total<span class="op">)</span>    <span class="op">:</span> 4 B</span>
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true" tabindex="-1"></a> params <span class="co">#           : 16,652 items (16.30 KiB)</span></span>
<span id="cb12-8"><a href="#cb12-8" aria-hidden="true" tabindex="-1"></a> macc               <span class="op">:</span> 336<span class="op">,</span>088</span>
<span id="cb12-9"><a href="#cb12-9" aria-hidden="true" tabindex="-1"></a> weights <span class="op">(</span>ro<span class="op">)</span>       <span class="op">:</span> 16<span class="op">,</span>688 B <span class="op">(</span>16<span class="op">.</span><span class="fu">30</span> KiB<span class="op">)</span></span>
<span id="cb12-10"><a href="#cb12-10" aria-hidden="true" tabindex="-1"></a> activations <span class="op">(</span>rw<span class="op">)</span>   <span class="op">:</span> 6<span class="op">,</span>128 B <span class="op">(</span>5<span class="op">.</span><span class="fu">98</span> KiB<span class="op">)</span> <span class="op">*</span></span>
<span id="cb12-11"><a href="#cb12-11" aria-hidden="true" tabindex="-1"></a> ram <span class="op">(</span>total<span class="op">)</span>        <span class="op">:</span> 6<span class="op">,</span>132 B <span class="op">(</span>5<span class="op">.</span><span class="fu">99</span> KiB<span class="op">)</span> <span class="op">=</span> 6<span class="op">,</span>128 <span class="op">+</span> 0 <span class="op">+</span> 4</span>
<span id="cb12-12"><a href="#cb12-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-13"><a href="#cb12-13" aria-hidden="true" tabindex="-1"></a> <span class="op">(*)</span> inputs are placed <span class="kw">in</span> the activations buffer</span>
<span id="cb12-14"><a href="#cb12-14" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span></code></pre></div>
</section>
</section>
<section id="ir-graph-description" class="level2">
<h2>IR graph description</h2>
<p>The outlined “graph” section (table form) provides a summary of the topology of the network which is considered before the optimization, render and generation stages. The <code>&#39;id&#39;</code> column indicates the index of the operator from the original graph. It is generated by the importer. The represented graph is an internal platform independent representation (or IR) created during the import of the model. Training only operators are ignored. Note that if no input operator is defined, an “input” layer is added and the non-linearity functions are un-fused. A complete graphic representation is available through the UI (refer to <a href="https://www.st.com/resource/en/user_manual/dm00570145.pdf">[UM]</a>).</p>
<div id="fig:mod_to_ir_muspeech" class="fignos">
<figure>
<img src="" property="center" style="width:100.0%" alt="Figure 3: IR Graph (microSpeech)" /><figcaption aria-hidden="true"><span>Figure 3:</span> IR Graph (microSpeech)</figcaption>
</figure>
</div>
<table>
<colgroup>
<col style="width: 14%" />
<col style="width: 85%" />
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">field</th>
<th style="text-align: left;">description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">id</td>
<td style="text-align: left;">indicates the layer/operator index in the original model.</td>
</tr>
<tr class="even">
<td style="text-align: left;">layer (type)</td>
<td style="text-align: left;">designates the name and type of the operator. Name is inferred from the original name. In the case where a non-linearity function is un-fused, the new IR-node is created with the original name suffixed with <code>&#39;_nl&#39;</code> (see next figure with the first layer)</td>
</tr>
<tr class="odd">
<td style="text-align: left;">shape</td>
<td style="text-align: left;">indicates the output shape of the layer. Follow the “HWC” layout or channel last representation: h=height, w=width, c=channel (refer to <a href="embedded_client_api.html">[API] “IO tensor”</a> section)</td>
</tr>
<tr class="even">
<td style="text-align: left;">param/size</td>
<td style="text-align: left;">indicates the number of parameters and their sizes in bytes (4-bytes aligned)</td>
</tr>
<tr class="odd">
<td style="text-align: left;">connected to</td>
<td style="text-align: left;">designates the name of the incoming operators/layers</td>
</tr>
<tr class="even">
<td style="text-align: left;">macc</td>
<td style="text-align: left;">designates the complexity in Multiply-ACCumulated operations, refer to <a href="evaluation_metrics.html">[METRIC]</a></td>
</tr>
</tbody>
</table>
<p>The right side of the table (<code>&#39;c_*&#39;</code> columns) reports generated C-object after optimization and rendering stages.</p>
<div id="fig:mod_to_ir_muspeech_2" class="fignos">
<figure>
<img src="" property="center" style="width:100.0%" alt="Figure 4: IR Graph with C-definitions" /><figcaption aria-hidden="true"><span>Figure 4:</span> IR Graph with C-definitions</figcaption>
</figure>
</div>
<table>
<colgroup>
<col style="width: 10%" />
<col style="width: 89%" />
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">field</th>
<th style="text-align: left;">description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">c_size</td>
<td style="text-align: left;">indicates the difference in bytes of the size for the implemented weights/params tensors. If nothing is indicated, the size is unchanged compared to the original size (<code>&#39;-/size&#39;</code> field)</td>
</tr>
<tr class="even">
<td style="text-align: left;">c_macc</td>
<td style="text-align: left;">indicates the difference in MACC. If nothing is displayed, the final complexity of the C-operator is comparable to the complexity of the original layer/operator (<code>&#39;macc&#39;</code> field).</td>
</tr>
<tr class="odd">
<td style="text-align: left;">c_type</td>
<td style="text-align: left;">indicates the type of the c-operator. Value between square is the index in the c-graph. Value between parenthesis is the data type: <code>&#39;()&#39;</code> indicates a float32 type, <code>&#39;(i)&#39;</code> for integer type, <code>&#39;(c4, c8)&#39;</code> for the compressed floating point layer (size includes also the associated dictionary). Multiple c-operators can be generated for a original operator.</td>
</tr>
</tbody>
</table>
<p>Footer summarizes the differences for the whole model including the requested RAM size for the activations buffer and for the IO tensors.</p>
<div class="sourceCode" id="cb13"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a>model<span class="op">/</span>c<span class="op">-</span>model<span class="op">:</span> macc<span class="op">=</span>369<span class="op">,</span>672<span class="op">/</span>369<span class="op">,</span>688 <span class="op">+</span>16<span class="op">(+</span>0<span class="op">.</span><span class="fu">0</span><span class="op">%)</span> weights<span class="op">=</span>18<span class="op">,</span>288<span class="op">/</span>18<span class="op">,</span>288</span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a>           activations<span class="op">=--/</span>6<span class="op">,</span>032 io<span class="op">=--/</span>2<span class="op">,</span>111</span></code></pre></div>
<p>In the case where the optimizer engine has folded or/and fused the IR nodes, the <code>&#39;c_type&#39;</code> is empty.</p>
<div id="fig:mod_to_ir_folding" class="fignos">
<figure>
<img src="" property="center" style="width:95.0%" alt="Figure 5: IR Graph - BN folding and NL fusing" /><figcaption aria-hidden="true"><span>Figure 5:</span> IR Graph - BN folding and NL fusing</figcaption>
</figure>
</div>
<p>Following figure is an example of IR graph with a residual neural network. As for the multiple branches, no specific information is added, <code>&#39;connected to&#39;</code> column allows to know the connections.</p>
<div id="fig:mod_to_ir_mnv2" class="fignos">
<figure>
<img src="" property="center" style="width:100.0%" alt="Figure 6: IR Graph - Residual case" /><figcaption aria-hidden="true"><span>Figure 6:</span> IR Graph - Residual case</figcaption>
</figure>
</div>
<div class="Alert">
<p><strong>Warning</strong> — For a compressed or quantized model, the MACC values (by layer or globally) are unchanged. Number of operations are always the same. Only the associated number of CPU cycles by MACC is changed. In particular, for the quantized models.</p>
</div>
<div id="fig:mod_to_ir_compressed" class="fignos">
<figure>
<img src="" property="center" style="width:100.0%" alt="Figure 7: IR Graph - Compressed floating point model" /><figcaption aria-hidden="true"><span>Figure 7:</span> IR Graph - Compressed floating point model</figcaption>
</figure>
</div>
</section>
<section id="complexity-report-per-layer" class="level2">
<h2>Complexity report per layer</h2>
<p>The last part of the report summarizes the relative network complexity in term of MACC and associated ROM size by layer. Note that only the operators which contribute to the global <code>&#39;c_macc&#39;</code> and <code>&#39;c_rom&#39;</code> metrics are reported. <code>&#39;c_id&#39;</code> indicates the index of the associated c-node.</p>
<div class="sourceCode" id="cb14"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a> Complexity report per layer <span class="op">-</span> macc<span class="op">=</span>18<span class="op">,</span>752<span class="op">,</span>688 weights<span class="op">=</span>7<span class="op">,</span>552 act<span class="op">=</span>3<span class="op">,</span>097<span class="op">,</span>600 ram_io<span class="op">=</span>602<span class="op">,</span>184</span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a> <span class="op">---------------------------------------------------------------------------------------------------</span></span>
<span id="cb14-3"><a href="#cb14-3" aria-hidden="true" tabindex="-1"></a> id   name                             c_macc                    c_rom                     c_id</span>
<span id="cb14-4"><a href="#cb14-4" aria-hidden="true" tabindex="-1"></a> <span class="op">---------------------------------------------------------------------------------------------------</span></span>
<span id="cb14-5"><a href="#cb14-5" aria-hidden="true" tabindex="-1"></a> 1    separable_conv1                  <span class="op">||</span>                 1<span class="op">.</span><span class="fu">8</span><span class="op">%</span>   <span class="op">||</span>                 1<span class="op">.</span><span class="fu">6</span><span class="op">%</span>   <span class="op">[</span>0<span class="op">]</span></span>
<span id="cb14-6"><a href="#cb14-6" aria-hidden="true" tabindex="-1"></a> 1    separable_conv1_conv2d           <span class="op">|||</span>                3<span class="op">.</span><span class="fu">2</span><span class="op">%</span>   <span class="op">||||</span>               3<span class="op">.</span><span class="fu">4</span><span class="op">%</span>   <span class="op">[</span>1<span class="op">]</span></span>
<span id="cb14-7"><a href="#cb14-7" aria-hidden="true" tabindex="-1"></a> 2    depthwise_conv2d_1               <span class="op">|||||||||</span>         10<span class="op">.</span><span class="fu">3</span><span class="op">%</span>   <span class="op">||||||||</span>           8<span class="op">.</span><span class="fu">5</span><span class="op">%</span>   <span class="op">[</span>2<span class="op">]</span></span>
<span id="cb14-8"><a href="#cb14-8" aria-hidden="true" tabindex="-1"></a> 3    conv2d_1                         <span class="op">||||||||||||||||</span>  17<span class="op">.</span><span class="fu">6</span><span class="op">%</span>   <span class="op">||||||||||||||</span>    14<span class="op">.</span><span class="fu">4</span><span class="op">%</span>   <span class="op">[</span>3<span class="op">]</span></span>
<span id="cb14-9"><a href="#cb14-9" aria-hidden="true" tabindex="-1"></a> 5    dw_conv_branch1                  <span class="op">||||||||</span>           9<span class="op">.</span><span class="fu">3</span><span class="op">%</span>   <span class="op">||||||||</span>           8<span class="op">.</span><span class="fu">5</span><span class="op">%</span>   <span class="op">[</span>7<span class="op">]</span></span>
<span id="cb14-10"><a href="#cb14-10" aria-hidden="true" tabindex="-1"></a> 6    pw_branch1                       <span class="op">||||||||||||||||</span>  17<span class="op">.</span><span class="fu">6</span><span class="op">%</span>   <span class="op">||||||||||||||</span>    14<span class="op">.</span><span class="fu">4</span><span class="op">%</span>   <span class="op">[</span>8<span class="op">]</span></span>
<span id="cb14-11"><a href="#cb14-11" aria-hidden="true" tabindex="-1"></a> 7    dw_conv_branch0                  <span class="op">||||||||</span>           9<span class="op">.</span><span class="fu">3</span><span class="op">%</span>   <span class="op">||||||||</span>           8<span class="op">.</span><span class="fu">5</span><span class="op">%</span>   <span class="op">[</span>6<span class="op">]</span></span>
<span id="cb14-12"><a href="#cb14-12" aria-hidden="true" tabindex="-1"></a> 8    batch_normalization_1            <span class="op">||</span>                 2<span class="op">.</span><span class="fu">1</span><span class="op">%</span>   <span class="op">||</span>                 1<span class="op">.</span><span class="fu">7</span><span class="op">%</span>   <span class="op">[</span>9<span class="op">]</span></span>
<span id="cb14-13"><a href="#cb14-13" aria-hidden="true" tabindex="-1"></a> 9    separable_conv1_branch2          <span class="op">||||||||</span>           9<span class="op">.</span><span class="fu">3</span><span class="op">%</span>   <span class="op">||||||||</span>           8<span class="op">.</span><span class="fu">5</span><span class="op">%</span>   <span class="op">[</span>4<span class="op">]</span></span>
<span id="cb14-14"><a href="#cb14-14" aria-hidden="true" tabindex="-1"></a> 9    separable_conv1_branch2_conv2d   <span class="op">|||||||||||||||</span>   16<span class="op">.</span><span class="fu">5</span><span class="op">%</span>   <span class="op">||||||||||||||</span>    14<span class="op">.</span><span class="fu">4</span><span class="op">%</span>   <span class="op">[</span>5<span class="op">]</span></span>
<span id="cb14-15"><a href="#cb14-15" aria-hidden="true" tabindex="-1"></a> 10   add_1                            <span class="op">||</span>                 2<span class="op">.</span><span class="fu">1</span><span class="op">%</span>   <span class="op">|</span>                  0<span class="op">.</span><span class="fu">0</span><span class="op">%</span>   <span class="op">[</span>10<span class="op">,</span> 11<span class="op">]</span></span>
<span id="cb14-16"><a href="#cb14-16" aria-hidden="true" tabindex="-1"></a> 11   global_average_pooling2d_1       <span class="op">|</span>                  1<span class="op">.</span><span class="fu">0</span><span class="op">%</span>   <span class="op">|</span>                  0<span class="op">.</span><span class="fu">0</span><span class="op">%</span>   <span class="op">[</span>12<span class="op">]</span></span>
<span id="cb14-17"><a href="#cb14-17" aria-hidden="true" tabindex="-1"></a> 12   dense_1                          <span class="op">|</span>                  0<span class="op">.</span><span class="fu">0</span><span class="op">%</span>   <span class="op">||||||||||||||||</span>  16<span class="op">.</span><span class="fu">2</span><span class="op">%</span>   <span class="op">[</span>13<span class="op">]</span></span>
<span id="cb14-18"><a href="#cb14-18" aria-hidden="true" tabindex="-1"></a> 12   dense_1_nl                       <span class="op">|</span>                  0<span class="op">.</span><span class="fu">0</span><span class="op">%</span>   <span class="op">|</span>                  0<span class="op">.</span><span class="fu">0</span><span class="op">%</span>   <span class="op">[</span>14<span class="op">]</span></span></code></pre></div>
</section>
<section id="c-graph-description" class="level2">
<h2>C-graph description</h2>
<p>Additional “Generated C-graph summary” section is included in the report (also displayed with <code>&#39;-v 2&#39;</code> argument). It summarizes the main computational and associated elements (c-objects) used by the C-inference engine (runtime library). It is based on the c-structures generated inside the <code>&#39;&lt;name&gt;.c&#39;</code> file. A complete graphic representation is available through the UI (refer to <a href="https://www.st.com/resource/en/user_manual/dm00570145.pdf">[UM]</a>).</p>
<p>The first part re-calls the main structural elements: c-name, number of c-nodes, number of C-array for the data storage of the associated tensors. Input and output name of the I/O tensors.</p>
<div class="sourceCode" id="cb15"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a>Generated C<span class="op">-</span>graph summary</span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a><span class="op">---------------------------------------------------------------------------------------------------</span></span>
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a>model name         <span class="op">:</span> microspeech_01</span>
<span id="cb15-4"><a href="#cb15-4" aria-hidden="true" tabindex="-1"></a>c<span class="op">-</span>name             <span class="op">:</span> network</span>
<span id="cb15-5"><a href="#cb15-5" aria-hidden="true" tabindex="-1"></a>c<span class="op">-</span>node <span class="co">#           : 5</span></span>
<span id="cb15-6"><a href="#cb15-6" aria-hidden="true" tabindex="-1"></a>c<span class="op">-</span>array <span class="co">#          : 11</span></span>
<span id="cb15-7"><a href="#cb15-7" aria-hidden="true" tabindex="-1"></a>activations size   <span class="op">:</span> 4352</span>
<span id="cb15-8"><a href="#cb15-8" aria-hidden="true" tabindex="-1"></a>weights size       <span class="op">:</span> 16688</span>
<span id="cb15-9"><a href="#cb15-9" aria-hidden="true" tabindex="-1"></a>macc               <span class="op">:</span> 336084</span>
<span id="cb15-10"><a href="#cb15-10" aria-hidden="true" tabindex="-1"></a>inputs             <span class="op">:</span> <span class="op">[</span>&#39;Reshape_1_output_array&#39;<span class="op">]</span></span>
<span id="cb15-11"><a href="#cb15-11" aria-hidden="true" tabindex="-1"></a>outputs            <span class="op">:</span> <span class="op">[</span>&#39;nl_2_fmt_output_array&#39;<span class="op">]</span></span></code></pre></div>
<p>As illustrated in the figure <a href="#fig:c_graph_overview">8</a>, the implemented c-graph can be considered as a sequential graph, managed as a simple linked list. Fixed-executing order is defined by the C-code optimizer according two main criteria: data-path dependencies (or tensor dependencies) and the minimization of the RAM memory peak usage.</p>
<div id="fig:c_graph_overview" class="fignos">
<figure>
<img src="" property="center" style="width:95.0%" alt="Figure 8: Computational c-graph objects" /><figcaption aria-hidden="true"><span>Figure 8:</span> Computational c-graph objects</figcaption>
</figure>
</div>
<p>Each computational c-node is entirely defined by:</p>
<ul>
<li>operation type, parameters<br />
</li>
<li>input tensors list: [I]<br />
</li>
<li><em>optional</em> weights/bias tensors list: [W]<br />
</li>
<li><em>optional</em> scratches tensors list: [S]</li>
<li>outputs tensors list: [O]</li>
</ul>
<section id="c-arrays-table" class="level3 unnumbered">
<h3 class="unnumbered">C-Arrays table</h3>
<p><code>&#39;C-Arrays&#39;</code> table lists the objects allowing to handle the base address, size and meta-data of the data memory segments for the different tensors. For each item, number of item, size in byte (<code>&#39;item/size&#39;</code>), memory segment location (<code>&#39;mem-pool&#39;</code>), type (<code>&#39;c-type&#39;</code>) and short format description (<code>&#39;fmt&#39;</code>) are reported.</p>
<div class="sourceCode" id="cb16"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a>C<span class="op">-</span>Arrays <span class="op">(</span>11<span class="op">)</span></span>
<span id="cb16-2"><a href="#cb16-2" aria-hidden="true" tabindex="-1"></a><span class="op">---------------------------------------------------------------------------------------------------</span></span>
<span id="cb16-3"><a href="#cb16-3" aria-hidden="true" tabindex="-1"></a>c_id  name <span class="op">(*</span>_array<span class="op">)</span>      item<span class="op">/</span>size           mem<span class="op">-</span>pool     c<span class="op">-</span>type         fmt         comment </span>
<span id="cb16-4"><a href="#cb16-4" aria-hidden="true" tabindex="-1"></a><span class="op">---------------------------------------------------------------------------------------------------</span></span>
<span id="cb16-5"><a href="#cb16-5" aria-hidden="true" tabindex="-1"></a>0     conv2d_0_scratch0   352<span class="op">/</span>352             activations  uint8_t        <span class="dt">int</span><span class="op">/</span>ss             </span>
<span id="cb16-6"><a href="#cb16-6" aria-hidden="true" tabindex="-1"></a>1     dense_1_bias        4<span class="op">/</span>16                weights      const int32_t  <span class="dt">int</span><span class="op">/</span>ss                   </span>
<span id="cb16-7"><a href="#cb16-7" aria-hidden="true" tabindex="-1"></a>2     dense_1_weights     16000<span class="op">/</span>16000         weights      const uint8_t  <span class="dt">int</span><span class="op">/</span>ua                  </span>
<span id="cb16-8"><a href="#cb16-8" aria-hidden="true" tabindex="-1"></a>3     conv2d_0_bias       8<span class="op">/</span>32                weights      const int32_t  <span class="dt">int</span><span class="op">/</span>ss                  </span>
<span id="cb16-9"><a href="#cb16-9" aria-hidden="true" tabindex="-1"></a>4     conv2d_0_weights    640<span class="op">/</span>640             weights      const uint8_t  <span class="dt">int</span><span class="op">/</span>ua                 </span>
<span id="cb16-10"><a href="#cb16-10" aria-hidden="true" tabindex="-1"></a>5     Reshape_1_output    1960<span class="op">/</span>1960           user         uint8_t        <span class="dt">int</span><span class="op">/</span>us      <span class="op">/</span>input     </span>
<span id="cb16-11"><a href="#cb16-11" aria-hidden="true" tabindex="-1"></a>6     conv2d_0_output     4000<span class="op">/</span>4000           activations  uint8_t        <span class="dt">int</span><span class="op">/</span>us                 </span>
<span id="cb16-12"><a href="#cb16-12" aria-hidden="true" tabindex="-1"></a>7     dense_1_output      4<span class="op">/</span>4                 activations  uint8_t        <span class="dt">int</span><span class="op">/</span>ua                 </span>
<span id="cb16-13"><a href="#cb16-13" aria-hidden="true" tabindex="-1"></a>8     dense_1_fmt_output  4<span class="op">/</span>16                activations  <span class="dt">float</span>          <span class="dt">float</span>                    </span>
<span id="cb16-14"><a href="#cb16-14" aria-hidden="true" tabindex="-1"></a>9     nl_2_output         4<span class="op">/</span>16                activations  <span class="dt">float</span>          <span class="dt">float</span>                  </span>
<span id="cb16-15"><a href="#cb16-15" aria-hidden="true" tabindex="-1"></a>10    nl_2_fmt_output     4<span class="op">/</span>4                 user         uint8_t        <span class="dt">int</span><span class="op">/</span>us      <span class="op">/</span>output    </span>
<span id="cb16-16"><a href="#cb16-16" aria-hidden="true" tabindex="-1"></a><span class="op">---------------------------------------------------------------------------------------------------</span></span></code></pre></div>
<table>
<colgroup>
<col style="width: 13%" />
<col style="width: 86%" />
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">mem_pool</th>
<th style="text-align: left;">description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">activations</td>
<td style="text-align: left;">part of the activations buffer</td>
</tr>
<tr class="even">
<td style="text-align: left;">weights</td>
<td style="text-align: left;">part of a <em>ROM</em> segment</td>
</tr>
<tr class="odd">
<td style="text-align: left;">user</td>
<td style="text-align: left;">part of a memory segment owned by the user (client application layer)</td>
</tr>
</tbody>
</table>
<table>
<colgroup>
<col style="width: 12%" />
<col style="width: 87%" />
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">fmt</th>
<th style="text-align: left;">format description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">float</td>
<td style="text-align: left;">32b float numbers</td>
</tr>
<tr class="even">
<td style="text-align: left;">c4/c8</td>
<td style="text-align: left;">compressed 32b float numbers. The size includes the dictionary.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">int</td>
<td style="text-align: left;">quantized data memory chunk using integer format (refer to <a href="quantization.html">[QUANT]</a>). <code>&#39;/channel (n)&#39;</code> indicates that per-channel scheme is used (else per-tensor).</td>
</tr>
</tbody>
</table>
<p><strong>C-Layers table</strong></p>
<p><code>&#39;C-Layers&#39;</code> table lists the c-nodes. For each node, the c-name (<code>name</code>), type, macc, rom and associated tensors (with the shape for the I/O tensors) are reported. Associated c-array can be found with its name (or array id).</p>
<div class="sourceCode" id="cb17"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a>C<span class="op">-</span>Layers <span class="op">(</span>5<span class="op">)</span></span>
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a><span class="op">---------------------------------------------------------------------------------------------------</span></span>
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a>c_id  name <span class="op">(*</span>_layer<span class="op">)</span>  id  <span class="fu">type</span>    macc        rom         tensors                shape <span class="op">(</span>array id<span class="op">)</span> </span>
<span id="cb17-4"><a href="#cb17-4" aria-hidden="true" tabindex="-1"></a><span class="op">---------------------------------------------------------------------------------------------------</span></span>
<span id="cb17-5"><a href="#cb17-5" aria-hidden="true" tabindex="-1"></a>0     conv2d_0        0   conv2d  320008      672         I<span class="op">:</span> Reshape_1_output    <span class="op">[</span>1<span class="op">,</span> 49<span class="op">,</span> 40<span class="op">,</span> 1<span class="op">]</span> <span class="op">(</span>5<span class="op">)</span></span>
<span id="cb17-6"><a href="#cb17-6" aria-hidden="true" tabindex="-1"></a>                                                          S<span class="op">:</span> conv2d_0_scratch0                     </span>
<span id="cb17-7"><a href="#cb17-7" aria-hidden="true" tabindex="-1"></a>                                                          W<span class="op">:</span> conv2d_0_weights                      </span>
<span id="cb17-8"><a href="#cb17-8" aria-hidden="true" tabindex="-1"></a>                                                          W<span class="op">:</span> conv2d_0_bias                         </span>
<span id="cb17-9"><a href="#cb17-9" aria-hidden="true" tabindex="-1"></a>                                                          O<span class="op">:</span> conv2d_0_output     <span class="op">[</span>1<span class="op">,</span> 25<span class="op">,</span> 20<span class="op">,</span> 8<span class="op">]</span> <span class="op">(</span>6<span class="op">)</span></span>
<span id="cb17-10"><a href="#cb17-10" aria-hidden="true" tabindex="-1"></a><span class="op">---------------------------------------------------------------------------------------------------</span></span>
<span id="cb17-11"><a href="#cb17-11" aria-hidden="true" tabindex="-1"></a>1     dense_1         1   dense   16000       16016       I<span class="op">:</span> conv2d_0_output0    <span class="op">[</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4000<span class="op">]</span> <span class="op">(</span>6<span class="op">)</span></span>
<span id="cb17-12"><a href="#cb17-12" aria-hidden="true" tabindex="-1"></a>                                                          W<span class="op">:</span> dense_1_weights                      </span>
<span id="cb17-13"><a href="#cb17-13" aria-hidden="true" tabindex="-1"></a>                                                          W<span class="op">:</span> dense_1_bias                      </span>
<span id="cb17-14"><a href="#cb17-14" aria-hidden="true" tabindex="-1"></a>                                                          O<span class="op">:</span> dense_1_output      <span class="op">[</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">]</span> <span class="op">(</span>7<span class="op">)</span> </span>
<span id="cb17-15"><a href="#cb17-15" aria-hidden="true" tabindex="-1"></a><span class="op">---------------------------------------------------------------------------------------------------</span></span>
<span id="cb17-16"><a href="#cb17-16" aria-hidden="true" tabindex="-1"></a>2     dense_1_fmt     1   nl      8           0           I<span class="op">:</span> dense_1_output      <span class="op">[</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">]</span> <span class="op">(</span>7<span class="op">)</span> </span>
<span id="cb17-17"><a href="#cb17-17" aria-hidden="true" tabindex="-1"></a>                                                          O<span class="op">:</span> dense_1_fmt_output  <span class="op">[</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">]</span> <span class="op">(</span>8<span class="op">)</span> </span>
<span id="cb17-18"><a href="#cb17-18" aria-hidden="true" tabindex="-1"></a><span class="op">---------------------------------------------------------------------------------------------------</span></span>
<span id="cb17-19"><a href="#cb17-19" aria-hidden="true" tabindex="-1"></a>3     nl_2            2   nl      60          0           I<span class="op">:</span> dense_1_fmt_output  <span class="op">[</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">]</span> <span class="op">(</span>8<span class="op">)</span> </span>
<span id="cb17-20"><a href="#cb17-20" aria-hidden="true" tabindex="-1"></a>                                                          O<span class="op">:</span> nl_2_output         <span class="op">[</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">]</span> <span class="op">(</span>9<span class="op">)</span> </span>
<span id="cb17-21"><a href="#cb17-21" aria-hidden="true" tabindex="-1"></a><span class="op">---------------------------------------------------------------------------------------------------</span></span>
<span id="cb17-22"><a href="#cb17-22" aria-hidden="true" tabindex="-1"></a>4     nl_2_fmt        2   nl      8           0           I<span class="op">:</span> nl_2_output         <span class="op">[</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">]</span> <span class="op">(</span>9<span class="op">)</span></span>
<span id="cb17-23"><a href="#cb17-23" aria-hidden="true" tabindex="-1"></a>                                                          O<span class="op">:</span> nl_2_fmt_output     <span class="op">[</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">]</span> <span class="op">(</span>10<span class="op">)</span></span>
<span id="cb17-24"><a href="#cb17-24" aria-hidden="true" tabindex="-1"></a><span class="op">---------------------------------------------------------------------------------------------------</span></span></code></pre></div>
<ul>
<li><code>&#39;id&#39;</code> designates the layer/operator index from the original model allowing to retrieve the link with the implemented node (<code>&#39;c_id&#39;</code>).</li>
</ul>
<div id="fig:id_map" class="fignos">
<figure>
<img src="" property="center" style="width:95.0%" alt="Figure 9: Original &#39;id&#39; and &#39;c_id&#39; mapping" /><figcaption aria-hidden="true"><span>Figure 9:</span> Original <code>&#39;id&#39;</code> and <code>&#39;c_id&#39;</code> mapping</figcaption>
</figure>
</div>
</section>
</section>
</section>
<section id="validate-command" class="level1">
<h1>Validate command</h1>
<section id="description-1" class="level2">
<h2>Description</h2>
<p>The <code>&#39;validate&#39;</code> command allows to import, to render and to validate the generated C-files. Please refer to <a href="https://www.st.com/resource/en/user_manual/dm00570145.pdf">[UM]</a>, <em>“Validation engine”</em> and <em>“AI validation application”</em> sections to have an overview of the underlying process. In particular for the validation on target (<code>&#39;--mode stm32&#39;</code>), the STM32 board should be flashed with a validation firmware including the model. Detailed description of the used metrics are described in <a href="evaluation_metrics.html">[METRIC]</a>.</p>
</section>
<section id="specific-arguments-1" class="level2">
<h2>Specific arguments</h2>
<table>
<colgroup>
<col style="width: 17%" />
<col style="width: 82%" />
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">parameter</th>
<th style="text-align: left;">description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;"><code>--mode</code></td>
<td style="text-align: left;">indicates the mode of validation. <code>&#39;x86&#39;</code> (<em>default value</em>) performs a validation on desktop. <code>&#39;stm32&#39;</code> <a href="#ref_stm32_io_only"><code>&#39;stm32_io_only&#39;</code></a> is used to perform a validation on target. - <em>Optional</em></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>-vi/valinput</code></td>
<td style="text-align: left;">indicates the custom test data set which must be used. If not defined an internal self-generated random data set is used (refer to [[METRIC], “Input validation files”][X_CUBE_AI_METRICS] section) - <em>Optional</em></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>-vo/valoutput</code></td>
<td style="text-align: left;">indicates the expected custom output values. If the data are already provided in a simple file (<code>&#39;*.npz&#39;</code>) through the <code>&#39;-vi&#39;</code> option this argument is skipped - <em>Optional</em></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>-b/--batches</code></td>
<td style="text-align: left;">indicates how many random data sample is generated (default: <code>&#39;10&#39;</code>) - <em>Optional</em></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>-d/--desc</code></td>
<td style="text-align: left;">describes the COM port which is used to communicate with a STM32 board (see <a href="#ref_valio_arg">“<code>desc</code> argument”</a> section) - <em>Optional</em></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>--full</code></td>
<td style="text-align: left;">if defined, this flag indicates that an <a href="#ref_complexity_per_layer">extended validation</a> process is applied to report the <em>L2r</em> error layer-by-layer. Else only the <em>L2r</em> is evaluated on the last or <em>output</em> layers. - <em>Optional</em></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>--classifier</code></td>
<td style="text-align: left;">if defined, this flag indicates that the provided model should be considered as a classifier vs regressor. This implies that the computation of the <code>&#39;CM&#39;</code> and <code>&#39;ACC&#39;</code> metrics will be evaluated, else an auto-detection mechanism is used to evaluate if the model is a classifier or not. - <em>Optional</em></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>--no-check</code></td>
<td style="text-align: left;">if defined and combined with the <code>&#39;stm32&#39;</code> mode, this “debug” flag allows to reduce the full preliminary check-list to make sure that the flashed STM32 C-model has been generated with the same tools and options. Only the c-name and network IO shape/format are checked. - <em>Optional</em></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>--no-exec-model</code></td>
<td style="text-align: left;">if defined, this flag allows to not execute the original model. Only the generated c-model is executed. - <em>Optional</em></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>--range</code></td>
<td style="text-align: left;">indicates the min and max values (in float) for the generated random data, default is <code>&#39;[0.0, 1.0[&#39;</code>. To generate randomly and uniformly the data between <code>&#39;-1.0&#39;</code> and <code>&#39;1.0&#39;</code>, following parameters should be passed: <code>&#39;--range -1 1&#39;</code>- <em>Optional</em></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>--seed</code></td>
<td style="text-align: left;">this option can be used to define the seed which is used to initialize the pseudo-randomnumber generator for the random data generation. Else a fixed seed is used - <em>Optional</em></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>--save-csv</code></td>
<td style="text-align: left;">indicates that the whole data are saved in the respective <a href="evaluation_metrics.html#ref_post_proc_support"><code>&#39;*.csv&#39;</code> files</a>. By default, for performance reasons, only a limited part are saved. - <em>Optional</em></td>
</tr>
</tbody>
</table>
<blockquote>
<p>The optional <code>--validate.batch_mode</code> option can be used when an input custom data set is used allowing to limit the number of samples. Two modes are possible,<code>&#39;first&#39;</code> to indicate that only the first <code>&#39;batches&#39;</code> samples are used and <code>&#39;random&#39;</code> to indicate that <code>&#39;batches&#39;</code> samples should be randomly selected with a fixed seed.</p>
</blockquote>
<p>At the end of the process, results are summarized in a simple table (see <a href="evaluation_metrics.html">[METRIC]</a> for a detailed description of the results).</p>
<div class="sourceCode" id="cb18"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a>Evaluation report <span class="op">(</span>summary<span class="op">)</span></span>
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a><span class="op">----------------------------------------------------------------------------------------------------------</span></span>
<span id="cb18-3"><a href="#cb18-3" aria-hidden="true" tabindex="-1"></a>Mode                 acc      rmse      mae       l2r       tensor</span>
<span id="cb18-4"><a href="#cb18-4" aria-hidden="true" tabindex="-1"></a><span class="op">----------------------------------------------------------------------------------------------------------</span></span>
<span id="cb18-5"><a href="#cb18-5" aria-hidden="true" tabindex="-1"></a>x86 C<span class="op">-</span>model <span class="co">#1       92.68%   0.053623  0.005785  0.340042  dense_4_nl [ai_float, [(1, 1, 36)], m_id=[10]]</span></span>
<span id="cb18-6"><a href="#cb18-6" aria-hidden="true" tabindex="-1"></a>original model <span class="co">#1    92.68%   0.053623  0.005785  0.340042  dense_4_nl [ai_float, [(1, 1, 36)], m_id=[10]]</span></span>
<span id="cb18-7"><a href="#cb18-7" aria-hidden="true" tabindex="-1"></a>X<span class="op">-</span>cross <span class="co">#1           100.00%  0.000000  0.000000  0.000000  dense_4_nl [ai_float, [(1, 1, 36)], m_id=[10]]</span></span>
<span id="cb18-8"><a href="#cb18-8" aria-hidden="true" tabindex="-1"></a><span class="op">----------------------------------------------------------------------------------------------------------</span></span></code></pre></div>
</section>
<section id="examples-1" class="level2">
<h2>Examples</h2>
<ul>
<li><p>Minimal command to validate a 32b float model with the self-generated random input data (“Validation on desktop”).</p>
<div class="sourceCode" id="cb19"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai validate <span class="op">-</span>m <span class="op">&lt;</span>model_f32p_file_path<span class="op">&gt;</span></span></code></pre></div></li>
<li><p>To report the <a href="#ref_complexity_per_layer">“L2r error”</a> and relative <a href="#execution-time-per-layer">execution time by layer</a> (“Validation on desktop”).</p>
<div class="sourceCode" id="cb20"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai validate <span class="op">-</span>m <span class="op">&lt;</span>model_f32p_file_path<span class="op">&gt;</span> <span class="op">--</span>full</span></code></pre></div></li>
<li><p>Minimal command to validate a 32b float model on STM32 target. Note that a complete profiling report including <a href="#execution-time-per-layer">execution time by layer</a> is generated by default.</p>
<div class="sourceCode" id="cb21"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai validate <span class="op">-</span>m <span class="op">&lt;</span>model_f32p_file_path<span class="op">&gt;</span> <span class="op">--</span>mode stm32</span></code></pre></div></li>
<li><p>Validation of a 32b float model with self-generated random input data and compression factor (“Validation on desktop”)</p>
<div class="sourceCode" id="cb22"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai validate <span class="op">-</span>m <span class="op">&lt;</span>model_f32p_file_path<span class="op">&gt;</span> <span class="op">-</span>c 4</span></code></pre></div></li>
<li><p>Validate a model with a custom data set</p></li>
</ul>
<div class="sourceCode" id="cb23"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai validate <span class="op">-</span>m <span class="op">&lt;</span>model_file_path<span class="op">&gt;</span> <span class="op">-</span>vi test_data<span class="op">.</span><span class="fu">csv</span></span></code></pre></div>
<ul>
<li><p>Validate a quantized model with a custom data set</p>
<div class="sourceCode" id="cb24"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai validate <span class="op">-</span>m <span class="op">&lt;</span>modified_model_file<span class="op">&gt;.</span><span class="fu">h5</span> <span class="op">-</span>q <span class="op">&lt;</span>quant_file_desc<span class="op">&gt;.</span><span class="fu">json</span> <span class="op">-</span>vi test_data<span class="op">.</span><span class="fu">npz</span></span></code></pre></div></li>
<li><p>Validate a model with only 20 randomly selected samples from a large custom data set</p>
<div class="sourceCode" id="cb25"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai validate <span class="op">-</span>m <span class="op">&lt;</span>modified_model_file<span class="op">&gt;.</span><span class="fu">h5</span> <span class="op">-</span>vi test_large_data<span class="op">.</span><span class="fu">npz</span> <span class="op">--</span>validate<span class="op">.</span><span class="fu">batch_mode</span> random <span class="op">-</span>b 20</span></code></pre></div></li>
</ul>
</section>
<section id="serial-com-port-configuration" class="level2">
<h2>Serial COM port configuration</h2>
<p>The <code>&#39;--desc/-d&#39;</code> argument should be used to indicate how to configure the serial COM driver to access the STM32 board. Previously, the STM32 board should be flashed with an <em>aiValidation</em> application (refer to <a href="https://www.st.com/resource/en/user_manual/dm00570145.pdf">[UM]</a>, <em>“AI validation application”</em> section).</p>
<p>By default, an auto-detection mechanism is applied to discover a connected board at <span class="citation" data-cites="115200">@115200</span> (default value: <code>default:115200</code>)</p>
<ul>
<li><p>set the baud-rate to <span class="citation" data-cites="961600">@961600</span></p>
<div class="sourceCode" id="cb26"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai validate <span class="op">-</span>m <span class="op">&lt;</span>model_file_path<span class="op">&gt;</span> <span class="op">--</span>mode stm32 <span class="op">-</span>d 921600</span></code></pre></div></li>
<li><p>set the COM port to <code>COM16</code> (Windows case ) or <code>/dev/ttyACM0</code> (Linux case)</p>
<div class="sourceCode" id="cb27"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai validate <span class="op">-</span>m <span class="op">&lt;</span>model_file_path<span class="op">&gt;</span> <span class="op">--</span>mode stm32 <span class="op">-</span>d COM16</span>
<span id="cb27-2"><a href="#cb27-2" aria-hidden="true" tabindex="-1"></a>$ stm32ai validate <span class="op">-</span>m <span class="op">&lt;</span>model_file_path<span class="op">&gt;</span> <span class="op">--</span>mode stm32 <span class="op">-</span>d <span class="op">/</span>dev<span class="op">/</span>ttyACM0</span></code></pre></div></li>
<li><p>set the COM port to <code>COM16</code> and the baud-rate <span class="citation" data-cites="921600">@921600</span></p>
<div class="sourceCode" id="cb28"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb28-1"><a href="#cb28-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai validate <span class="op">-</span>m <span class="op">&lt;</span>model_file_path<span class="op">&gt;</span> <span class="op">--</span>mode stm32 <span class="op">-</span>d COM16<span class="op">:</span>921600</span></code></pre></div></li>
</ul>
</section>
<section id="ref_complexity_per_layer" class="level2">
<h2>Extended complexity report per layer</h2>
<p>If <code>&#39;-v 2&#39;</code> option is used, the <a href="#complexity-report-per-layer">“Complexity report per layer”</a> table is extended with a specific column to report the metric according the data type: <code>&#39;l2r&#39;</code> for the floating point models and <code>&#39;rmse&#39;</code> for the integer or quantized models. By default, the metric is computed only on the last layers (outputs of the model), however for the Keras floating point model, the <code>&#39;--full&#39;</code> option allows to compute this error layer-by-layer.</p>
<p><em>*</em> indicates the max value</p>
<div class="sourceCode" id="cb29"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb29-1"><a href="#cb29-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai validate <span class="op">-</span>m <span class="op">&lt;</span>model_f32p_file_path<span class="op">&gt;</span> <span class="op">-</span>v 2</span>
<span id="cb29-2"><a href="#cb29-2" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span>
<span id="cb29-3"><a href="#cb29-3" aria-hidden="true" tabindex="-1"></a> Complexity report per layer <span class="op">-</span> macc<span class="op">=</span>4<span class="op">,</span>013 weights<span class="op">=</span>15<span class="op">,</span>560 act<span class="op">=</span>192 ram_io<span class="op">=</span>416</span>
<span id="cb29-4"><a href="#cb29-4" aria-hidden="true" tabindex="-1"></a> <span class="op">---------------------------------------------------------------------------------------------------------</span></span>
<span id="cb29-5"><a href="#cb29-5" aria-hidden="true" tabindex="-1"></a> id   name           c_macc                    c_rom                     c_id   c_dur    l2r <span class="op">(</span>X<span class="op">-</span>CROSS<span class="op">)</span></span>
<span id="cb29-6"><a href="#cb29-6" aria-hidden="true" tabindex="-1"></a> <span class="op">---------------------------------------------------------------------------------------------------------</span></span>
<span id="cb29-7"><a href="#cb29-7" aria-hidden="true" tabindex="-1"></a> 0    dense_1        <span class="op">||||||||||||||||</span>  82<span class="op">.</span><span class="fu">2</span><span class="op">%</span>   <span class="op">||||||||||||||||</span>  84<span class="op">.</span><span class="fu">8</span><span class="op">%</span>   <span class="op">[</span>0<span class="op">]</span>     11<span class="op">.</span><span class="fu">3</span><span class="op">%</span></span>
<span id="cb29-8"><a href="#cb29-8" aria-hidden="true" tabindex="-1"></a> 1    activation_1   <span class="op">|</span>                  0<span class="op">.</span><span class="fu">8</span><span class="op">%</span>   <span class="op">|</span>                  0<span class="op">.</span><span class="fu">0</span><span class="op">%</span>   <span class="op">[</span>1<span class="op">]</span>     13<span class="op">.</span><span class="fu">3</span><span class="op">%</span></span>
<span id="cb29-9"><a href="#cb29-9" aria-hidden="true" tabindex="-1"></a> 2    dense_2        <span class="op">|||</span>               12<span class="op">.</span><span class="fu">7</span><span class="op">%</span>   <span class="op">|||</span>               13<span class="op">.</span><span class="fu">1</span><span class="op">%</span>   <span class="op">[</span>2<span class="op">]</span>     16<span class="op">.</span><span class="fu">5</span><span class="op">%</span></span>
<span id="cb29-10"><a href="#cb29-10" aria-hidden="true" tabindex="-1"></a> 3    activation_2   <span class="op">|</span>                  0<span class="op">.</span><span class="fu">4</span><span class="op">%</span>   <span class="op">|</span>                  0<span class="op">.</span><span class="fu">0</span><span class="op">%</span>   <span class="op">[</span>3<span class="op">]</span>     17<span class="op">.</span><span class="fu">7</span><span class="op">%</span></span>
<span id="cb29-11"><a href="#cb29-11" aria-hidden="true" tabindex="-1"></a> 4    dense_3        <span class="op">|</span>                  2<span class="op">.</span><span class="fu">0</span><span class="op">%</span>   <span class="op">|</span>                  2<span class="op">.</span><span class="fu">1</span><span class="op">%</span>   <span class="op">[</span>4<span class="op">]</span>     19<span class="op">.</span><span class="fu">4</span><span class="op">%</span></span>
<span id="cb29-12"><a href="#cb29-12" aria-hidden="true" tabindex="-1"></a> 5    activation_3   <span class="op">|</span>                  1<span class="op">.</span><span class="fu">9</span><span class="op">%</span>   <span class="op">|</span>                  0<span class="op">.</span><span class="fu">0</span><span class="op">%</span>   <span class="op">[</span>5<span class="op">]</span>     21<span class="op">.</span><span class="fu">9</span><span class="op">%</span>   3<span class="op">.</span><span class="fu">95458301e</span><span class="op">-</span>07 <span class="op">*</span></span>
<span id="cb29-13"><a href="#cb29-13" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span></code></pre></div>
<div class="sourceCode" id="cb30"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai validate <span class="op">-</span>m <span class="op">&lt;</span>model_f32p_file_path<span class="op">&gt;</span> <span class="op">--</span>full</span>
<span id="cb30-2"><a href="#cb30-2" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span>
<span id="cb30-3"><a href="#cb30-3" aria-hidden="true" tabindex="-1"></a> Complexity report per layer <span class="op">-</span> macc<span class="op">=</span>4<span class="op">,</span>013 weights<span class="op">=</span>15<span class="op">,</span>560 act<span class="op">=</span>192 ram_io<span class="op">=</span>416</span>
<span id="cb30-4"><a href="#cb30-4" aria-hidden="true" tabindex="-1"></a> <span class="op">---------------------------------------------------------------------------------------------------------</span></span>
<span id="cb30-5"><a href="#cb30-5" aria-hidden="true" tabindex="-1"></a> id   name           c_macc                    c_rom                     c_id   c_dur    l2r <span class="op">(</span>X<span class="op">-</span>CROSS<span class="op">)</span></span>
<span id="cb30-6"><a href="#cb30-6" aria-hidden="true" tabindex="-1"></a> <span class="op">---------------------------------------------------------------------------------------------------------</span></span>
<span id="cb30-7"><a href="#cb30-7" aria-hidden="true" tabindex="-1"></a> 0    dense_1        <span class="op">||||||||||||||||</span>  82<span class="op">.</span><span class="fu">2</span><span class="op">%</span>   <span class="op">||||||||||||||||</span>  84<span class="op">.</span><span class="fu">8</span><span class="op">%</span>   <span class="op">[</span>0<span class="op">]</span>     11<span class="op">.</span><span class="fu">0</span><span class="op">%</span>   5<span class="op">.</span><span class="fu">62010030e</span><span class="op">-</span>08</span>
<span id="cb30-8"><a href="#cb30-8" aria-hidden="true" tabindex="-1"></a> 1    activation_1   <span class="op">|</span>                  0<span class="op">.</span><span class="fu">8</span><span class="op">%</span>   <span class="op">|</span>                  0<span class="op">.</span><span class="fu">0</span><span class="op">%</span>   <span class="op">[</span>1<span class="op">]</span>     13<span class="op">.</span><span class="fu">3</span><span class="op">%</span>   5<span class="op">.</span><span class="fu">57235715e</span><span class="op">-</span>08</span>
<span id="cb30-9"><a href="#cb30-9" aria-hidden="true" tabindex="-1"></a> 2    dense_2        <span class="op">|||</span>               12<span class="op">.</span><span class="fu">7</span><span class="op">%</span>   <span class="op">|||</span>               13<span class="op">.</span><span class="fu">1</span><span class="op">%</span>   <span class="op">[</span>2<span class="op">]</span>     16<span class="op">.</span><span class="fu">3</span><span class="op">%</span>   8<span class="op">.</span><span class="fu">20674515e</span><span class="op">-</span>08</span>
<span id="cb30-10"><a href="#cb30-10" aria-hidden="true" tabindex="-1"></a> 3    activation_2   <span class="op">|</span>                  0<span class="op">.</span><span class="fu">4</span><span class="op">%</span>   <span class="op">|</span>                  0<span class="op">.</span><span class="fu">0</span><span class="op">%</span>   <span class="op">[</span>3<span class="op">]</span>     18<span class="op">.</span><span class="fu">0</span><span class="op">%</span>   8<span class="op">.</span><span class="fu">00048383e</span><span class="op">-</span>08</span>
<span id="cb30-11"><a href="#cb30-11" aria-hidden="true" tabindex="-1"></a> 4    dense_3        <span class="op">|</span>                  2<span class="op">.</span><span class="fu">0</span><span class="op">%</span>   <span class="op">|</span>                  2<span class="op">.</span><span class="fu">1</span><span class="op">%</span>   <span class="op">[</span>4<span class="op">]</span>     19<span class="op">.</span><span class="fu">6</span><span class="op">%</span>   1<span class="op">.</span><span class="fu">32168850e</span><span class="op">-</span>07</span>
<span id="cb30-12"><a href="#cb30-12" aria-hidden="true" tabindex="-1"></a> 5    activation_3   <span class="op">|</span>                  1<span class="op">.</span><span class="fu">9</span><span class="op">%</span>   <span class="op">|</span>                  0<span class="op">.</span><span class="fu">0</span><span class="op">%</span>   <span class="op">[</span>5<span class="op">]</span>     21<span class="op">.</span><span class="fu">9</span><span class="op">%</span>   3<span class="op">.</span><span class="fu">95458301e</span><span class="op">-</span>07 <span class="op">*</span></span>
<span id="cb30-13"><a href="#cb30-13" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span></code></pre></div>
<div class="Alert">
<p><strong>Warning</strong> — <code>&#39;--full&#39;</code> option can be also used for validation on target (<code>&#39;--mode stm32&#39;</code>), to report the <em>L2r</em> error per layer, however, be aware that the validation time is significantly increased due to the upload of the intermediate results.</p>
</div>
</section>
<section id="execution-time-per-layer" class="level2">
<h2>Execution time per layer</h2>
<section id="validation-on-target" class="level3">
<h3>Validation on target</h3>
<p>The validation on target allows to have a <em>full and accurate profiling</em> report including:</p>
<ul>
<li>inference-time</li>
<li>number of CPU cycles by MACC</li>
<li>execution time per layer</li>
<li>STM32 HW settings/configurations (clock frequency, memory configuration)</li>
</ul>
<div class="HTips">
<p><strong>Note</strong> — All these information are also available through the <em>“aiSystemPerformance”</em> application (refer to <a href="https://www.st.com/resource/en/user_manual/dm00570145.pdf">[UM]</a>)</p>
</div>
<div class="sourceCode" id="cb31"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb31-1"><a href="#cb31-1" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span>
<span id="cb31-2"><a href="#cb31-2" aria-hidden="true" tabindex="-1"></a>Running the STM AI c<span class="op">-</span>model <span class="op">(</span>AI RUNNER<span class="op">)...(</span>name<span class="op">=</span>network<span class="op">,</span> mode<span class="op">=</span>stm32<span class="op">)</span></span>
<span id="cb31-3"><a href="#cb31-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb31-4"><a href="#cb31-4" aria-hidden="true" tabindex="-1"></a> STM Proto<span class="op">-</span>buffer protocol 2<span class="op">.</span><span class="fu">2</span> <span class="op">(</span>SERIAL<span class="op">:</span>COM6<span class="op">:</span>115200<span class="op">:</span>connected<span class="op">)</span> <span class="op">[</span>&#39;network&#39;<span class="op">]</span></span>
<span id="cb31-5"><a href="#cb31-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb31-6"><a href="#cb31-6" aria-hidden="true" tabindex="-1"></a> Summary <span class="st">&quot;network&quot;</span> <span class="op">-</span> <span class="op">[</span>&#39;network&#39;<span class="op">]</span></span>
<span id="cb31-7"><a href="#cb31-7" aria-hidden="true" tabindex="-1"></a> <span class="op">--------------------------------------------------------------------------------</span></span>
<span id="cb31-8"><a href="#cb31-8" aria-hidden="true" tabindex="-1"></a> inputs<span class="op">/</span>outputs       <span class="op">:</span> 1<span class="op">/</span>1</span>
<span id="cb31-9"><a href="#cb31-9" aria-hidden="true" tabindex="-1"></a> input_1              <span class="op">:</span> <span class="op">(</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 1960<span class="op">),</span> int8<span class="op">,</span> 1960 bytes<span class="op">,</span> scale<span class="op">=</span>0<span class="op">.</span><span class="fu">10171568393707275</span><span class="op">,</span> zp<span class="op">=-</span>128<span class="op">,</span> user</span>
<span id="cb31-10"><a href="#cb31-10" aria-hidden="true" tabindex="-1"></a> output_1             <span class="op">:</span> <span class="op">(</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">),</span> int8<span class="op">,</span> 4 bytes<span class="op">,</span> scale<span class="op">=</span>0<span class="op">.</span><span class="fu">00390625</span><span class="op">,</span> zp<span class="op">=-</span>128<span class="op">,</span> user</span>
<span id="cb31-11"><a href="#cb31-11" aria-hidden="true" tabindex="-1"></a> n_nodes              <span class="op">:</span> 5</span>
<span id="cb31-12"><a href="#cb31-12" aria-hidden="true" tabindex="-1"></a> compile_datetime     <span class="op">:</span> Jun 11 2021 23<span class="op">:</span>37<span class="op">:</span>49 <span class="op">(</span>Mon May 31 11<span class="op">:</span>47<span class="op">:</span>28 2021<span class="op">)</span></span>
<span id="cb31-13"><a href="#cb31-13" aria-hidden="true" tabindex="-1"></a> activations          <span class="op">:</span> 5712</span>
<span id="cb31-14"><a href="#cb31-14" aria-hidden="true" tabindex="-1"></a> weights              <span class="op">:</span> 16688</span>
<span id="cb31-15"><a href="#cb31-15" aria-hidden="true" tabindex="-1"></a> macc                 <span class="op">:</span> 336088</span>
<span id="cb31-16"><a href="#cb31-16" aria-hidden="true" tabindex="-1"></a> <span class="op">--------------------------------------------------------------------------------</span></span>
<span id="cb31-17"><a href="#cb31-17" aria-hidden="true" tabindex="-1"></a> runtime              <span class="op">:</span> Protocol 2<span class="op">.</span><span class="fu">2</span> <span class="op">-</span> STM<span class="op">.</span><span class="fu">AI</span> <span class="op">(/</span>gcc<span class="op">)</span> 7<span class="op">.</span><span class="fu">0</span><span class="op">.</span><span class="fu">0</span> <span class="op">(</span>Tools 7<span class="op">.</span><span class="fu">0</span><span class="op">.</span><span class="fu">0</span><span class="op">)</span></span>
<span id="cb31-18"><a href="#cb31-18" aria-hidden="true" tabindex="-1"></a> capabilities         <span class="op">:</span> <span class="op">[</span>&#39;IO_ONLY&#39;<span class="op">,</span> &#39;PER_LAYER&#39;<span class="op">,</span> &#39;PER_LAYER_WITH_DATA&#39;<span class="op">,</span> &#39;SELF_TEST&#39;<span class="op">]</span></span>
<span id="cb31-19"><a href="#cb31-19" aria-hidden="true" tabindex="-1"></a> device               <span class="op">:</span> 0x431 <span class="op">-</span> STM32F411xC<span class="op">/</span>E @100<span class="op">/</span>100MHz fpu<span class="op">,</span>art_lat<span class="op">=</span>3<span class="op">,</span>art_prefetch<span class="op">,</span></span>
<span id="cb31-20"><a href="#cb31-20" aria-hidden="true" tabindex="-1"></a>                        art_icache<span class="op">,</span>art_dcache</span>
<span id="cb31-21"><a href="#cb31-21" aria-hidden="true" tabindex="-1"></a> <span class="op">--------------------------------------------------------------------------------</span></span>
<span id="cb31-22"><a href="#cb31-22" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb31-23"><a href="#cb31-23" aria-hidden="true" tabindex="-1"></a> Results <span class="kw">for</span> 10 inference<span class="op">(</span>s<span class="op">)</span> <span class="op">-</span> average per inference</span>
<span id="cb31-24"><a href="#cb31-24" aria-hidden="true" tabindex="-1"></a>  device              <span class="op">:</span> 0x431 <span class="op">-</span> STM32F411xC<span class="op">/</span>E @100<span class="op">/</span>100MHz fpu<span class="op">,</span>art_lat<span class="op">=</span>3<span class="op">,</span>art_prefetch<span class="op">,</span></span>
<span id="cb31-25"><a href="#cb31-25" aria-hidden="true" tabindex="-1"></a>                        art_icache<span class="op">,</span>art_dcache</span>
<span id="cb31-26"><a href="#cb31-26" aria-hidden="true" tabindex="-1"></a>  duration            <span class="op">:</span> 34<span class="op">.</span><span class="fu">089ms</span></span>
<span id="cb31-27"><a href="#cb31-27" aria-hidden="true" tabindex="-1"></a>  CPU cycles          <span class="op">:</span> 3408875</span>
<span id="cb31-28"><a href="#cb31-28" aria-hidden="true" tabindex="-1"></a>  cycles<span class="op">/</span>MACC         <span class="op">:</span> 10<span class="op">.</span><span class="fu">14</span></span>
<span id="cb31-29"><a href="#cb31-29" aria-hidden="true" tabindex="-1"></a>  c_nodes             <span class="op">:</span> 5</span>
<span id="cb31-30"><a href="#cb31-30" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb31-31"><a href="#cb31-31" aria-hidden="true" tabindex="-1"></a> c_id  m_id  desc            oshape          fmt      ms          <span class="op">%</span></span>
<span id="cb31-32"><a href="#cb31-32" aria-hidden="true" tabindex="-1"></a> <span class="op">---------------------------------------------------------------------------</span></span>
<span id="cb31-33"><a href="#cb31-33" aria-hidden="true" tabindex="-1"></a> 0     1     Conv2D <span class="op">(</span>0x103<span class="op">)</span>  <span class="op">(</span>1<span class="op">,</span> 25<span class="op">,</span> 20<span class="op">,</span> 8<span class="op">)</span>  int8         33<span class="op">.</span><span class="fu">478</span>   98<span class="op">.</span><span class="fu">2</span><span class="op">%</span></span>
<span id="cb31-34"><a href="#cb31-34" aria-hidden="true" tabindex="-1"></a> 1     2     Dense <span class="op">(</span>0x104<span class="op">)</span>   <span class="op">(</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">)</span>    int8          0<span class="op">.</span><span class="fu">592</span>    1<span class="op">.</span><span class="fu">7</span><span class="op">%</span></span>
<span id="cb31-35"><a href="#cb31-35" aria-hidden="true" tabindex="-1"></a> 2     2     NL <span class="op">(</span>0x107<span class="op">)</span>      <span class="op">(</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">)</span>    float32       0<span class="op">.</span><span class="fu">003</span>    0<span class="op">.</span><span class="fu">0</span><span class="op">%</span></span>
<span id="cb31-36"><a href="#cb31-36" aria-hidden="true" tabindex="-1"></a> 3     3     NL <span class="op">(</span>0x107<span class="op">)</span>      <span class="op">(</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">)</span>    float32       0<span class="op">.</span><span class="fu">011</span>    0<span class="op">.</span><span class="fu">0</span><span class="op">%</span></span>
<span id="cb31-37"><a href="#cb31-37" aria-hidden="true" tabindex="-1"></a> 4     3     NL <span class="op">(</span>0x107<span class="op">)</span>      <span class="op">(</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">)</span>    int8          0<span class="op">.</span><span class="fu">004</span>    0<span class="op">.</span><span class="fu">0</span><span class="op">%</span></span>
<span id="cb31-38"><a href="#cb31-38" aria-hidden="true" tabindex="-1"></a> <span class="op">---------------------------------------------------------------------------</span></span>
<span id="cb31-39"><a href="#cb31-39" aria-hidden="true" tabindex="-1"></a>                                                          34<span class="op">.</span><span class="fu">089</span> ms</span>
<span id="cb31-40"><a href="#cb31-40" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span></code></pre></div>
<p>This report can be used to identify the main contributors and to re-fine the model accordingly. <code>&#39;c_id&#39;</code> column references the index of the c-node (see <a href="#c-graph-description">“C-graph description”</a> section) and the <code>&#39;m_id&#39;</code> indicates the index from the original model.</p>
</section>
<section id="ref_stm32_io_only" class="level3">
<h3>stm32 out-of-the-box execution</h3>
<p>When <code>&#39;stm32_io_only&#39;</code> mode is used, the stm32 model is only executed out-of-the-box. Executing time or l2r per layer are no more computed. This can be used to limit the traffic between the host and the target decreasing the validation time.</p>
</section>
<section id="validation-on-desktop" class="level3 unnumbered">
<h3 class="unnumbered">Validation on desktop</h3>
<p>For the validation on desktop, by default a relative execution time per layer is also reported. Nevertheless, it is important to note that the values are only the <strong>indicators</strong>, they are dependent on the implementation of the kernels which are not optimized and the work-load of the desktop machine in contrary to the reported inference times for the validation on target.</p>
<div class="sourceCode" id="cb32"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb32-1"><a href="#cb32-1" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span>
<span id="cb32-2"><a href="#cb32-2" aria-hidden="true" tabindex="-1"></a>Running the STM AI c<span class="op">-</span>model <span class="op">(</span>AI RUNNER<span class="op">)...(</span>name<span class="op">=</span>network<span class="op">,</span> mode<span class="op">=</span>x86<span class="op">)</span></span>
<span id="cb32-3"><a href="#cb32-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb32-4"><a href="#cb32-4" aria-hidden="true" tabindex="-1"></a> X86 shared lib <span class="op">(&lt;</span>model_build_path<span class="op">&gt;</span>\libai_network<span class="op">.</span><span class="fu">dll</span><span class="op">)</span> <span class="op">[</span>&#39;network&#39;<span class="op">]</span></span>
<span id="cb32-5"><a href="#cb32-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb32-6"><a href="#cb32-6" aria-hidden="true" tabindex="-1"></a> Summary <span class="st">&quot;network&quot;</span> <span class="op">-</span> <span class="op">[</span>&#39;network&#39;<span class="op">]</span></span>
<span id="cb32-7"><a href="#cb32-7" aria-hidden="true" tabindex="-1"></a> <span class="op">--------------------------------------------------------------------------------</span></span>
<span id="cb32-8"><a href="#cb32-8" aria-hidden="true" tabindex="-1"></a> inputs<span class="op">/</span>outputs       <span class="op">:</span> 1<span class="op">/</span>1</span>
<span id="cb32-9"><a href="#cb32-9" aria-hidden="true" tabindex="-1"></a> input_1              <span class="op">:</span> <span class="op">(</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 1960<span class="op">),</span> int8<span class="op">,</span> 1960 bytes<span class="op">,</span> scale<span class="op">=</span>0<span class="op">.</span><span class="fu">10171568393707275</span><span class="op">,</span> zp<span class="op">=-</span>128<span class="op">,</span> user</span>
<span id="cb32-10"><a href="#cb32-10" aria-hidden="true" tabindex="-1"></a> output_1             <span class="op">:</span> <span class="op">(</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">),</span> int8<span class="op">,</span> 4 bytes<span class="op">,</span> scale<span class="op">=</span>0<span class="op">.</span><span class="fu">00390625</span><span class="op">,</span> zp<span class="op">=-</span>128<span class="op">,</span> user</span>
<span id="cb32-11"><a href="#cb32-11" aria-hidden="true" tabindex="-1"></a> n_nodes              <span class="op">:</span> 5</span>
<span id="cb32-12"><a href="#cb32-12" aria-hidden="true" tabindex="-1"></a> compile_datetime     <span class="op">:</span> Jun 11 2021 23<span class="op">:</span>48<span class="op">:</span>50 <span class="op">(</span>Fri Jun 11 23<span class="op">:</span>48<span class="op">:</span>48 2021<span class="op">)</span></span>
<span id="cb32-13"><a href="#cb32-13" aria-hidden="true" tabindex="-1"></a> activations          <span class="op">:</span> 5712</span>
<span id="cb32-14"><a href="#cb32-14" aria-hidden="true" tabindex="-1"></a> weights              <span class="op">:</span> 16688</span>
<span id="cb32-15"><a href="#cb32-15" aria-hidden="true" tabindex="-1"></a> macc                 <span class="op">:</span> 336088</span>
<span id="cb32-16"><a href="#cb32-16" aria-hidden="true" tabindex="-1"></a> <span class="op">--------------------------------------------------------------------------------</span></span>
<span id="cb32-17"><a href="#cb32-17" aria-hidden="true" tabindex="-1"></a> runtime              <span class="op">:</span> STM<span class="op">.</span><span class="fu">AI</span> 7<span class="op">.</span><span class="fu">0</span><span class="op">.</span><span class="fu">0</span> <span class="op">(</span>Tools 7<span class="op">.</span><span class="fu">0</span><span class="op">.</span><span class="fu">0</span><span class="op">)</span></span>
<span id="cb32-18"><a href="#cb32-18" aria-hidden="true" tabindex="-1"></a> capabilities         <span class="op">:</span> <span class="op">[</span>&#39;IO_ONLY&#39;<span class="op">,</span> &#39;PER_LAYER&#39;<span class="op">,</span> &#39;PER_LAYER_WITH_DATA&#39;<span class="op">]</span></span>
<span id="cb32-19"><a href="#cb32-19" aria-hidden="true" tabindex="-1"></a> device               <span class="op">:</span> AMD64 Intel64 Family 6 Model 78 Stepping 3<span class="op">,</span> GenuineIntel <span class="op">(</span>Windows<span class="op">)</span></span>
<span id="cb32-20"><a href="#cb32-20" aria-hidden="true" tabindex="-1"></a> <span class="op">--------------------------------------------------------------------------------</span></span>
<span id="cb32-21"><a href="#cb32-21" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb32-22"><a href="#cb32-22" aria-hidden="true" tabindex="-1"></a> Results <span class="kw">for</span> 10 inference<span class="op">(</span>s<span class="op">)</span> <span class="op">-</span> average per inference</span>
<span id="cb32-23"><a href="#cb32-23" aria-hidden="true" tabindex="-1"></a>  device              <span class="op">:</span> AMD64 Intel64 Family 6 Model 78 Stepping 3<span class="op">,</span> GenuineIntel <span class="op">(</span>Windows<span class="op">)</span></span>
<span id="cb32-24"><a href="#cb32-24" aria-hidden="true" tabindex="-1"></a>  duration            <span class="op">:</span> 5<span class="op">.</span><span class="fu">875ms</span></span>
<span id="cb32-25"><a href="#cb32-25" aria-hidden="true" tabindex="-1"></a>  c_nodes             <span class="op">:</span> 5</span>
<span id="cb32-26"><a href="#cb32-26" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb32-27"><a href="#cb32-27" aria-hidden="true" tabindex="-1"></a> c_id  m_id  desc            oshape          fmt      ms          <span class="op">%</span></span>
<span id="cb32-28"><a href="#cb32-28" aria-hidden="true" tabindex="-1"></a> <span class="op">---------------------------------------------------------------------------</span></span>
<span id="cb32-29"><a href="#cb32-29" aria-hidden="true" tabindex="-1"></a> 0     1     Conv2D <span class="op">(</span>0x103<span class="op">)</span>  <span class="op">(</span>1<span class="op">,</span> 25<span class="op">,</span> 20<span class="op">,</span> 8<span class="op">)</span>  int8          1<span class="op">.</span><span class="fu">136</span>   19<span class="op">.</span><span class="fu">3</span><span class="op">%</span></span>
<span id="cb32-30"><a href="#cb32-30" aria-hidden="true" tabindex="-1"></a> 1     2     Dense <span class="op">(</span>0x104<span class="op">)</span>   <span class="op">(</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">)</span>    int8          1<span class="op">.</span><span class="fu">182</span>   20<span class="op">.</span><span class="fu">1</span><span class="op">%</span></span>
<span id="cb32-31"><a href="#cb32-31" aria-hidden="true" tabindex="-1"></a> 2     2     NL <span class="op">(</span>0x107<span class="op">)</span>      <span class="op">(</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">)</span>    float32       1<span class="op">.</span><span class="fu">184</span>   20<span class="op">.</span><span class="fu">2</span><span class="op">%</span></span>
<span id="cb32-32"><a href="#cb32-32" aria-hidden="true" tabindex="-1"></a> 3     3     NL <span class="op">(</span>0x107<span class="op">)</span>      <span class="op">(</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">)</span>    float32       1<span class="op">.</span><span class="fu">187</span>   20<span class="op">.</span><span class="fu">2</span><span class="op">%</span></span>
<span id="cb32-33"><a href="#cb32-33" aria-hidden="true" tabindex="-1"></a> 4     3     NL <span class="op">(</span>0x107<span class="op">)</span>      <span class="op">(</span>1<span class="op">,</span> 1<span class="op">,</span> 1<span class="op">,</span> 4<span class="op">)</span>    int8          1<span class="op">.</span><span class="fu">188</span>   20<span class="op">.</span><span class="fu">2</span><span class="op">%</span></span>
<span id="cb32-34"><a href="#cb32-34" aria-hidden="true" tabindex="-1"></a> <span class="op">---------------------------------------------------------------------------</span></span>
<span id="cb32-35"><a href="#cb32-35" aria-hidden="true" tabindex="-1"></a>                                                           5<span class="op">.</span><span class="fu">875</span> ms</span>
<span id="cb32-36"><a href="#cb32-36" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb32-37"><a href="#cb32-37" aria-hidden="true" tabindex="-1"></a> NOTE<span class="op">:</span> duration and exec time per layer is just an indication<span class="op">.</span> They are dependent</span>
<span id="cb32-38"><a href="#cb32-38" aria-hidden="true" tabindex="-1"></a>       of the HOST<span class="op">-</span>machine work<span class="op">-</span>load<span class="op">.</span></span>
<span id="cb32-39"><a href="#cb32-39" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span></code></pre></div>
<ul>
<li><code>&#39;c_id&#39;</code> designates the c-layer index in the <a href="#c-graph-description">“C-graph description”</a>.</li>
</ul>
<div class="Alert">
<p><strong>Warning</strong> — Reported execution time per layer and global inference time are just the indicators. Be aware that the X86 C network runtime has been designed as an emulation of the STM32 C network runtime allowing <a href="how_to_run_a_model_locally.html">efficient functional verification flow</a> w/o STM32 board.</p>
</div>
</section>
</section>
</section>
<section id="generate-command" class="level1">
<h1>Generate command</h1>
<section id="description-2" class="level2">
<h2>Description</h2>
<p>The <code>&#39;generate&#39;</code> command is used to generate the specialized network and data C-files.</p>
<div class="sourceCode" id="cb33"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb33-1"><a href="#cb33-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai generate <span class="op">-</span>m <span class="op">&lt;</span>model_file_path<span class="op">&gt;</span> <span class="op">-</span>o <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span></span>
<span id="cb33-2"><a href="#cb33-2" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span>
<span id="cb33-3"><a href="#cb33-3" aria-hidden="true" tabindex="-1"></a>Generated files <span class="op">(</span>5<span class="op">)</span></span>
<span id="cb33-4"><a href="#cb33-4" aria-hidden="true" tabindex="-1"></a><span class="op">-----------------------------------------------------------</span></span>
<span id="cb33-5"><a href="#cb33-5" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_config<span class="op">.</span><span class="fu">h</span></span>
<span id="cb33-6"><a href="#cb33-6" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;.</span><span class="fu">c</span></span>
<span id="cb33-7"><a href="#cb33-7" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_data<span class="op">.</span><span class="fu">c</span></span>
<span id="cb33-8"><a href="#cb33-8" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;.</span><span class="fu">h</span></span>
<span id="cb33-9"><a href="#cb33-9" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_data<span class="op">.</span><span class="fu">h</span></span>
<span id="cb33-10"><a href="#cb33-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb33-11"><a href="#cb33-11" aria-hidden="true" tabindex="-1"></a>Creating report file <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\network_generate_report<span class="op">.</span><span class="fu">txt</span></span>
<span id="cb33-12"><a href="#cb33-12" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span></code></pre></div>
<ul>
<li><p><code>&#39;&lt;name&gt;.c/.h&#39;</code> files contain the topology of the C-model (C-struct definition of the tensors and the operators), including the embedded inference client API (refer to <a href="embedded_client_api.html">[API]</a>) to use the generated c-model on the top of the optimized inference runtime library.</p></li>
<li><p><code>&#39;&lt;name&gt;_data.c/.h&#39;</code> files are by default a simple C-array with the data of the weight/bias tensors. However, the <code>&#39;--split-weights&#39;</code> option allows to have a C-array by tensor (refer to <a href="embedded_client_api.html#ref_split_weights">[API], “<em>Split weights buffer</em>”</a> section) and the <code>&#39;--binary&#39;</code> option creates a binary file with the data of the weight/bias tensors. The <code>&#39;--relocatable&#39;</code> option allows to generate a relocatable binary model including the topology definition, the requested kernels and the weights in a single binary file (refer to <a href="relocatable.html">[RELOC]</a>).</p></li>
</ul>
</section>
<section id="specific-arguments-2" class="level2">
<h2>Specific arguments</h2>
<table>
<colgroup>
<col style="width: 22%" />
<col style="width: 77%" />
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">parameter</th>
<th style="text-align: left;">description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;"><code>--binary</code></td>
<td style="text-align: left;">if defined, this flag forces the generation of a binary file <code>&#39;&lt;name&gt;_data.bin&#39;</code>. The <code>&#39;&lt;name&gt;_data.c&#39;</code> and <code>&#39;&lt;name&gt;_data.h&#39;</code> files are always generated (see <a href="#ref_addr_options"><em>“Particular network data c-file”</em></a> section). Note the this binary file contains <strong>ONLY</strong> the data of the different weights/bias tensors, C-implementation of the topology (including the meta-data, scale/zero-point…) is always generated in the <code>&lt;name&gt;.c/.h</code> files. - <em>Optional</em></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>--address</code></td>
<td style="text-align: left;">with <code>--binary</code> flag, this helper option can be used to indicate the address where the weights will be located to generate a particular generated <a href="#ref_addr_options"><code>&#39;&lt;name&gt;_data.c&#39;</code></a> file. - <em>Optional</em></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>--copy-weights-at</code></td>
<td style="text-align: left;">with <code>--binary</code> flag and <code>--address</code> option, this helper option can be used to indicate the destination address where the weights should be copied at initialization time thanks to a particular generated <a href="#ref_addr_options"><code>&#39;&lt;name&gt;_data.c&#39;</code></a> file. - <em>Optional</em></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>--dll</code></td>
<td style="text-align: left;">if defined, this option allows to generate only a X86 shared library which can be used by the <a href="how_to_run_a_model_locally.html"><code>ai_runner</code> module</a> for advanced validation purpose - <em>Optional</em></td>
</tr>
</tbody>
</table>
<p>Specific arguments to generate a relocatable binary model (refer to <a href="relocatable.html">[RELOC]</a> for details).</p>
<table>
<colgroup>
<col style="width: 21%" />
<col style="width: 78%" />
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">parameter</th>
<th style="text-align: left;">description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;"><code>-r/--relocatable</code></td>
<td style="text-align: left;">if defined this option allows to generate a relocatable binary model. <code>&#39;--binary&#39;</code> option can be used to have a separate binary file with only the data of the weight/bias tensors. - <em>Optional</em></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>--lib</code></td>
<td style="text-align: left;">indicates the root directory to find the relocatable network runtime libraries. Typical value: <code>&#39;$X_CUBE_AI_DIR/Middlewares/ST/AI&#39;</code>. - <em>Optional</em></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>--series</code></td>
<td style="text-align: left;">indicates the targeted STM32 series for the generation of the relocatable binary model. Possible values: <code>stm32f4</code> (default), <code>stm32f3</code>, <code>stm32l4</code>, <code>stm32f7</code>, <code>stm32h7</code>, <code>stm32l5</code>, <code>stm32wl</code>, <code>stm32mp1</code>. - <em>Optional</em></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>--no-c-files</code></td>
<td style="text-align: left;">if defined, this flags avoids to generate the specific C-files. - <em>Optional</em></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>--ihex</code></td>
<td style="text-align: left;">with <code>--relocatable/--address</code> options, if defined, an additional file (Intel hexadecimal object file format) is generated. <code>--address</code> option is used to define the base address. - <em>Optional</em></td>
</tr>
</tbody>
</table>
<div class="Alert">
<p><strong>Warning</strong> — the <code>--split-weights</code> and <code>--copy-weights-at</code> features are not supported with the <code>--relocatable</code> option.</p>
</div>
</section>
<section id="examples-2" class="level2">
<h2>Examples</h2>
<ul>
<li><p>Generate the specialized NN C-files (default options).</p>
<div class="sourceCode" id="cb34"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb34-1"><a href="#cb34-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai generate <span class="op">-</span>m <span class="op">&lt;</span>model_file_path<span class="op">&gt;</span></span></code></pre></div></li>
<li><p>Generate the specialized NN C-files for a 32b float model with compression factor.</p>
<div class="sourceCode" id="cb35"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb35-1"><a href="#cb35-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai generate <span class="op">-</span>m <span class="op">&lt;</span>model_file_path<span class="op">&gt;</span> <span class="op">-</span>c 8</span></code></pre></div></li>
<li><p>Generate the specialized NN C-files for a Keras post-quantized model.</p>
<div class="sourceCode" id="cb36"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb36-1"><a href="#cb36-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai generate <span class="op">-</span>m <span class="op">&lt;</span>model_file_path<span class="op">&gt;</span> <span class="op">-</span>q <span class="op">&lt;</span>quant_file_desc<span class="op">&gt;.</span><span class="fu">json</span></span></code></pre></div></li>
<li><p>Generate only the network NN C-file, weights/bias parameters are provided as a binary file/object.</p>
<div class="sourceCode" id="cb37"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb37-1"><a href="#cb37-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai generate <span class="op">-</span>m <span class="op">&lt;</span>model_file_path<span class="op">&gt;</span> <span class="op">-</span>o <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span> <span class="op">-</span>n <span class="op">&lt;</span>name<span class="op">&gt;</span> <span class="op">--</span>binary</span>
<span id="cb37-2"><a href="#cb37-2" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span>
<span id="cb37-3"><a href="#cb37-3" aria-hidden="true" tabindex="-1"></a>Generated files <span class="op">(</span>6<span class="op">)</span></span>
<span id="cb37-4"><a href="#cb37-4" aria-hidden="true" tabindex="-1"></a><span class="op">-----------------------------------------------------------</span></span>
<span id="cb37-5"><a href="#cb37-5" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_config<span class="op">.</span><span class="fu">h</span></span>
<span id="cb37-6"><a href="#cb37-6" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;.</span><span class="fu">h</span></span>
<span id="cb37-7"><a href="#cb37-7" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;.</span><span class="fu">c</span></span>
<span id="cb37-8"><a href="#cb37-8" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_data<span class="op">.</span><span class="fu">bin</span></span>
<span id="cb37-9"><a href="#cb37-9" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_data<span class="op">.</span><span class="fu">h</span></span>
<span id="cb37-10"><a href="#cb37-10" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_data<span class="op">.</span><span class="fu">c</span></span>
<span id="cb37-11"><a href="#cb37-11" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb37-12"><a href="#cb37-12" aria-hidden="true" tabindex="-1"></a>Creating report file <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_generate_report<span class="op">.</span><span class="fu">txt</span></span>
<span id="cb37-13"><a href="#cb37-13" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span></code></pre></div></li>
<li><p>Generate a full relocatable binary file for a STM32H7 series (refer to <a href="relocatable.html">[RELOC]</a>).</p>
<div class="sourceCode" id="cb38"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb38-1"><a href="#cb38-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai generate <span class="op">-</span>m <span class="op">&lt;</span>model_file_path<span class="op">&gt;</span> <span class="op">-</span>o <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span> <span class="op">--</span>relocatable <span class="op">--</span>series stm32h7</span>
<span id="cb38-2"><a href="#cb38-2" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span>
<span id="cb38-3"><a href="#cb38-3" aria-hidden="true" tabindex="-1"></a>Generated files <span class="op">(</span>8<span class="op">)</span></span>
<span id="cb38-4"><a href="#cb38-4" aria-hidden="true" tabindex="-1"></a><span class="op">-----------------------------------------------------------</span></span>
<span id="cb38-5"><a href="#cb38-5" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_config<span class="op">.</span><span class="fu">h</span></span>
<span id="cb38-6"><a href="#cb38-6" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;.</span><span class="fu">h</span></span>
<span id="cb38-7"><a href="#cb38-7" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;.</span><span class="fu">c</span></span>
<span id="cb38-8"><a href="#cb38-8" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_data<span class="op">.</span><span class="fu">h</span></span>
<span id="cb38-9"><a href="#cb38-9" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_data<span class="op">.</span><span class="fu">c</span></span>
<span id="cb38-10"><a href="#cb38-10" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_rel<span class="op">.</span><span class="fu">bin</span></span>
<span id="cb38-11"><a href="#cb38-11" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_img_rel<span class="op">.</span><span class="fu">c</span></span>
<span id="cb38-12"><a href="#cb38-12" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_img_rel<span class="op">.</span><span class="fu">h</span></span>
<span id="cb38-13"><a href="#cb38-13" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb38-14"><a href="#cb38-14" aria-hidden="true" tabindex="-1"></a>Creating report file <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\network_generate_report<span class="op">.</span><span class="fu">txt</span></span>
<span id="cb38-15"><a href="#cb38-15" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span></code></pre></div></li>
<li><p>Generate a relocatable binary file w/o the weights for a STM32F4 series. Weights/bias data are generated in a separated binary file (refer to <a href="relocatable.html">[RELOC]</a>)</p>
<div class="sourceCode" id="cb39"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb39-1"><a href="#cb39-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai generate <span class="op">-</span>m <span class="op">&lt;</span>model_file_path<span class="op">&gt;</span> <span class="op">-</span>o <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span> <span class="op">-</span>n <span class="op">&lt;</span>name<span class="op">&gt;</span> <span class="op">--</span>relocatable <span class="op">--</span>binary</span>
<span id="cb39-2"><a href="#cb39-2" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span>
<span id="cb39-3"><a href="#cb39-3" aria-hidden="true" tabindex="-1"></a>Generated files <span class="op">(</span>9<span class="op">)</span></span>
<span id="cb39-4"><a href="#cb39-4" aria-hidden="true" tabindex="-1"></a><span class="op">-----------------------------------------------------------</span></span>
<span id="cb39-5"><a href="#cb39-5" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_config<span class="op">.</span><span class="fu">h</span></span>
<span id="cb39-6"><a href="#cb39-6" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;.</span><span class="fu">h</span></span>
<span id="cb39-7"><a href="#cb39-7" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;.</span><span class="fu">c</span></span>
<span id="cb39-8"><a href="#cb39-8" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_data<span class="op">.</span><span class="fu">h</span></span>
<span id="cb39-9"><a href="#cb39-9" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_data<span class="op">.</span><span class="fu">c</span></span>
<span id="cb39-10"><a href="#cb39-10" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_data<span class="op">.</span><span class="fu">bin</span></span>
<span id="cb39-11"><a href="#cb39-11" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_rel<span class="op">.</span><span class="fu">bin</span></span>
<span id="cb39-12"><a href="#cb39-12" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_img_rel<span class="op">.</span><span class="fu">c</span></span>
<span id="cb39-13"><a href="#cb39-13" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_img_rel<span class="op">.</span><span class="fu">h</span></span>
<span id="cb39-14"><a href="#cb39-14" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb39-15"><a href="#cb39-15" aria-hidden="true" tabindex="-1"></a>Creating report file <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_generate_report<span class="op">.</span><span class="fu">txt</span></span>
<span id="cb39-16"><a href="#cb39-16" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span></code></pre></div></li>
</ul>
</section>
<section id="ref_addr_options" class="level2">
<h2>Particular network data c-file</h2>
<p>The helper <code>&#39;--address&#39;</code> and <code>&#39;--copy-weights-at&#39;</code> options are the convenience options to generate a specific <code>ai_network_data_weights_get()</code> function. The returned address is passed to the <code>ai_&lt;network&gt;_init()</code> function thanks the <code>ai_network_params</code> structure (refer to <a href="embedded_client_api.html">[API]</a>). Note that this (including copy function) can be fully managed by the application code itself.</p>
<p>If the <code>--binary</code> (or <code>--relocatable</code>) option is passed without the <code>&#39;--address&#39;</code> or <code>&#39;--copy-weights-at&#39;</code> arguments, following <code>network_data.c</code> file is generated</p>
<div class="sourceCode" id="cb40"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb40-1"><a href="#cb40-1" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im">&quot;network_data.h&quot;</span></span>
<span id="cb40-2"><a href="#cb40-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb40-3"><a href="#cb40-3" aria-hidden="true" tabindex="-1"></a>ai_handle ai_network_data_weights_get<span class="op">(</span><span class="dt">void</span><span class="op">)</span></span>
<span id="cb40-4"><a href="#cb40-4" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb40-5"><a href="#cb40-5" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> AI_HANDLE_NULL<span class="op">;</span></span>
<span id="cb40-6"><a href="#cb40-6" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>Example of generated <code>network_data.c</code> file with the <code>--binary</code> and <code>--address 0x810000</code> options.</p>
<div class="sourceCode" id="cb41"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb41-1"><a href="#cb41-1" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im">&quot;network_data.h&quot;</span></span>
<span id="cb41-2"><a href="#cb41-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb41-3"><a href="#cb41-3" aria-hidden="true" tabindex="-1"></a><span class="pp">#define AI_NETWORK_DATA_ADDR 0x810000</span></span>
<span id="cb41-4"><a href="#cb41-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb41-5"><a href="#cb41-5" aria-hidden="true" tabindex="-1"></a>ai_handle ai_network_data_weights_get<span class="op">(</span><span class="dt">void</span><span class="op">)</span></span>
<span id="cb41-6"><a href="#cb41-6" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb41-7"><a href="#cb41-7" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> AI_HANDLE_PTR<span class="op">(</span>AI_NETWORK_DATA_ADDR<span class="op">);</span></span>
<span id="cb41-8"><a href="#cb41-8" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>Example of generated <code>network_data.c</code> file with the <code>--binary</code>, <code>--address 0x810000</code> and <code>--copy-weights-at 0xD0000000</code> options.</p>
<div class="sourceCode" id="cb42"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb42-1"><a href="#cb42-1" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im">&lt;string.h&gt;</span></span>
<span id="cb42-2"><a href="#cb42-2" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im">&quot;network_data.h&quot;</span></span>
<span id="cb42-3"><a href="#cb42-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb42-4"><a href="#cb42-4" aria-hidden="true" tabindex="-1"></a><span class="pp">#define AI_NETWORK_DATA_ADDR 0x81000</span></span>
<span id="cb42-5"><a href="#cb42-5" aria-hidden="true" tabindex="-1"></a><span class="pp">#define AI_NETWORK_DATA_DST_ADDR 0cD0000000</span></span>
<span id="cb42-6"><a href="#cb42-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb42-7"><a href="#cb42-7" aria-hidden="true" tabindex="-1"></a>ai_handle ai_network_data_weights_get<span class="op">(</span><span class="dt">void</span><span class="op">)</span></span>
<span id="cb42-8"><a href="#cb42-8" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb42-9"><a href="#cb42-9" aria-hidden="true" tabindex="-1"></a>  memcpy<span class="op">((</span><span class="dt">void</span> <span class="op">*)</span>AI_NETWORK_DATA_DST_ADDR<span class="op">,</span> <span class="op">(</span><span class="dt">const</span> <span class="dt">void</span> <span class="op">*)</span>AI_NETWORK_DATA_ADDR<span class="op">,</span></span>
<span id="cb42-10"><a href="#cb42-10" aria-hidden="true" tabindex="-1"></a>                                            AI_NETWORK_DATA_WEIGHTS_SIZE<span class="op">);</span></span>
<span id="cb42-11"><a href="#cb42-11" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> AI_HANDLE_PTR<span class="op">(</span>AI_NETWORK_DATA_DST_ADDR<span class="op">);</span></span>
<span id="cb42-12"><a href="#cb42-12" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
</section>
<section id="update_c_files" class="level2">
<h2>Update an ioc-based project</h2>
<p>For a X-CUBE-AI IDE project (ioc-based), the user has the possibility to update only the generated NN C-files. In this case, the <code>&#39;--output&#39;</code> option is used to indicate the root directory of the IDE project, i.e. location of the <code>&#39;.ioc&#39;</code> file. The destination of the previous NN c-files are automatically discovered in the source tree else output directory is used.</p>
<div class="sourceCode" id="cb43"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb43-1"><a href="#cb43-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai generate <span class="op">-</span>m <span class="op">&lt;</span>model_path<span class="op">&gt;</span> <span class="op">-</span>n <span class="op">&lt;</span>name<span class="op">&gt;</span> <span class="op">-</span>c 4 <span class="op">-</span>o <span class="op">&lt;</span>root_project_folder<span class="op">&gt;</span></span>
<span id="cb43-2"><a href="#cb43-2" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span>
<span id="cb43-3"><a href="#cb43-3" aria-hidden="true" tabindex="-1"></a>IOC file found <span class="kw">in</span> the output directory</span>
<span id="cb43-4"><a href="#cb43-4" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span>
<span id="cb43-5"><a href="#cb43-5" aria-hidden="true" tabindex="-1"></a>Generated files <span class="op">(</span>5<span class="op">)</span></span>
<span id="cb43-6"><a href="#cb43-6" aria-hidden="true" tabindex="-1"></a><span class="op">-----------------------------------------------------------</span></span>
<span id="cb43-7"><a href="#cb43-7" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>root_project_folder<span class="op">&gt;</span>\Inc\<span class="op">&lt;</span>name<span class="op">&gt;</span>_config<span class="op">.</span><span class="fu">h</span></span>
<span id="cb43-8"><a href="#cb43-8" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>root_project_folder<span class="op">&gt;</span>\Src\<span class="op">&lt;</span>name<span class="op">&gt;.</span><span class="fu">c</span></span>
<span id="cb43-9"><a href="#cb43-9" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>root_project_folder<span class="op">&gt;</span>\Src\<span class="op">&lt;</span>name<span class="op">&gt;</span>_data<span class="op">.</span><span class="fu">c</span></span>
<span id="cb43-10"><a href="#cb43-10" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>root_project_folder<span class="op">&gt;</span>\Inc\<span class="op">&lt;</span>name<span class="op">&gt;.</span><span class="fu">h</span></span>
<span id="cb43-11"><a href="#cb43-11" aria-hidden="true" tabindex="-1"></a> <span class="op">&lt;</span>root_project_folder<span class="op">&gt;</span>\Inc\<span class="op">&lt;</span>name<span class="op">&gt;</span>_data<span class="op">.</span><span class="fu">h</span></span>
<span id="cb43-12"><a href="#cb43-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb43-13"><a href="#cb43-13" aria-hidden="true" tabindex="-1"></a>Creating report file <span class="op">&lt;</span>root_project_folder<span class="op">&gt;</span>\<span class="op">&lt;</span>name<span class="op">&gt;</span>_generate_report<span class="op">.</span><span class="fu">txt</span></span>
<span id="cb43-14"><a href="#cb43-14" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span></code></pre></div>
<p>For multiple networks support, the update mechanism for a particular model is the same. <strong>Users</strong> should be vigilant to use the correct <em>name</em> (<code>&#39;--name my_name&#39;</code>) to avoid to overwrite/update an incorrect file and to be aligned with the multi-network helpers functions which are only generated by the X-CUBE-AI UI: <code>&#39;app_x-cube-ai.c/.h&#39;</code> files. If the number of networks is changed, X-CUBE-AI UI should be used to update the generated c-models.</p>
</section>
<section id="update-a-proprietary-source-tree" class="level2">
<h2>Update a proprietary source tree</h2>
<p>The <code>&#39;--output&#39;</code> option is used to indicate the single destination of the generated NN C-files. Note that an empty file with the <code>&#39;.ioc&#39;</code> extension can be defined in the root directory of the custom source tree to use the discovery mechanism as for the <a href="#update-an-ioc-based-project">update of an ioc-based project</a>.</p>
</section>
</section>
<section id="supported-ops-command" class="level1">
<h1>Supported-ops command</h1>
<section id="description-3" class="level2">
<h2>Description</h2>
<p>The <code>&#39;suppoorted-ops&#39;</code> command is used to display the list of the supported operators for a given deep learning framework with the <a href="#dl_framework_detection"><code>&#39;-t/--type&#39;</code></a> option. Else by default, all operators are listed.</p>
</section>
<section id="specific-arguments-3" class="level2">
<h2>Specific arguments</h2>
<table>
<colgroup>
<col style="width: 31%" />
<col style="width: 68%" />
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">parameter</th>
<th style="text-align: left;">description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;"><code>--with-report</code></td>
<td style="text-align: left;">if defined, this flag allows to generate a report, txt file (Markdown format) with the list of the operators and associated constraints. - <em>Optional</em></td>
</tr>
</tbody>
</table>
<p>This option has been used to generate the following articles: <a href="supported_ops_keras.html">“Keras toolbox support”</a>, <a href="supported_ops_tflite.html">&quot;TFLite toolbox support</a> and <a href="supported_ops_onnx.html">“ONNX toolbox support”</a></p>
</section>
<section id="examples-3" class="level2">
<h2>Examples</h2>
<ul>
<li><p>Generate the list of the supported operators (default)</p>
<div class="sourceCode" id="cb44"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb44-1"><a href="#cb44-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai supported<span class="op">-</span>ops</span>
<span id="cb44-2"><a href="#cb44-2" aria-hidden="true" tabindex="-1"></a>Neural Network Tools <span class="kw">for</span> STM32AI v1<span class="op">.</span><span class="fu">5</span><span class="op">.</span><span class="fu">1</span> <span class="op">(</span>STM<span class="op">.</span><span class="fu">ai</span> v7<span class="op">.</span><span class="fu">0</span><span class="op">.</span><span class="fu">0</span><span class="op">)</span></span>
<span id="cb44-3"><a href="#cb44-3" aria-hidden="true" tabindex="-1"></a>246 operators found</span>
<span id="cb44-4"><a href="#cb44-4" aria-hidden="true" tabindex="-1"></a>    Abs <span class="op">(</span>ONNX<span class="op">),</span> ABS <span class="op">(</span>TFLITE<span class="op">),</span> Acos <span class="op">(</span>ONNX<span class="op">),</span> Acosh <span class="op">(</span>ONNX<span class="op">),</span> Activation <span class="op">(</span>KERAS<span class="op">),</span> </span>
<span id="cb44-5"><a href="#cb44-5" aria-hidden="true" tabindex="-1"></a>    ActivityRegularization <span class="op">(</span>KERAS<span class="op">),</span> Add <span class="op">(</span>KERAS<span class="op">),</span> Add <span class="op">(</span>ONNX<span class="op">),</span> ADD <span class="op">(</span>TFLITE<span class="op">),</span></span>
<span id="cb44-6"><a href="#cb44-6" aria-hidden="true" tabindex="-1"></a>    AlphaDropout <span class="op">(</span>KERAS<span class="op">),</span> And <span class="op">(</span>ONNX<span class="op">),</span> ARG_MAX <span class="op">(</span>TFLITE<span class="op">),</span> ARG_MIN <span class="op">(</span>TFLITE<span class="op">),</span></span>
<span id="cb44-7"><a href="#cb44-7" aria-hidden="true" tabindex="-1"></a>    ArgMax <span class="op">(</span>ONNX<span class="op">),</span> ArgMin <span class="op">(</span>ONNX<span class="op">),</span> ArrayFeatureExtractor <span class="op">(</span>ONNX<span class="op">),</span> Asin <span class="op">(</span>ONNX<span class="op">),</span></span>
<span id="cb44-8"><a href="#cb44-8" aria-hidden="true" tabindex="-1"></a>    Asinh <span class="op">(</span>ONNX<span class="op">),...</span></span></code></pre></div></li>
<li><p>Generate the list of the supported Keras operators</p>
<div class="sourceCode" id="cb45"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb45-1"><a href="#cb45-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai supported<span class="op">-</span>ops <span class="op">-</span>t keras</span>
<span id="cb45-2"><a href="#cb45-2" aria-hidden="true" tabindex="-1"></a>Neural Network Tools <span class="kw">for</span> STM32AI v1<span class="op">.</span><span class="fu">5</span><span class="op">.</span><span class="fu">1</span> <span class="op">(</span>STM<span class="op">.</span><span class="fu">ai</span> v7<span class="op">.</span><span class="fu">0</span><span class="op">.</span><span class="fu">0</span><span class="op">)</span></span>
<span id="cb45-3"><a href="#cb45-3" aria-hidden="true" tabindex="-1"></a>Parsing operators <span class="kw">for</span> KERAS toolbox</span>
<span id="cb45-4"><a href="#cb45-4" aria-hidden="true" tabindex="-1"></a>53 operators found</span>
<span id="cb45-5"><a href="#cb45-5" aria-hidden="true" tabindex="-1"></a>    Activation<span class="op">,</span> ActivityRegularization<span class="op">,</span> Add<span class="op">,</span> AlphaDropout<span class="op">,</span> Average<span class="op">,</span> AveragePooling1D<span class="op">,</span></span>
<span id="cb45-6"><a href="#cb45-6" aria-hidden="true" tabindex="-1"></a>    AveragePooling2D<span class="op">,</span> BatchNormalization<span class="op">,</span> Bidirectional<span class="op">,</span> Concatenate<span class="op">,</span> Conv1D<span class="op">,</span> Conv2D<span class="op">,</span></span>
<span id="cb45-7"><a href="#cb45-7" aria-hidden="true" tabindex="-1"></a>    Conv2DTranspose<span class="op">,</span> Cropping1D<span class="op">,</span> Cropping2D<span class="op">,</span> CustomUnpack<span class="op">,</span> Dense<span class="op">,</span> DepthwiseConv2D<span class="op">,</span></span>
<span id="cb45-8"><a href="#cb45-8" aria-hidden="true" tabindex="-1"></a>    Dropout<span class="op">,</span> ELU<span class="op">,</span> Flatten<span class="op">,</span> GaussianDropout<span class="op">,</span> GaussianNoise<span class="op">,</span> GlobalAveragePooling1D<span class="op">,</span></span>
<span id="cb45-9"><a href="#cb45-9" aria-hidden="true" tabindex="-1"></a>    GlobalAveragePooling2D<span class="op">,</span> GlobalMaxPooling1D<span class="op">,</span> GlobalMaxPooling2D<span class="op">,</span> GRU<span class="op">,</span> InputLayer<span class="op">,</span></span>
<span id="cb45-10"><a href="#cb45-10" aria-hidden="true" tabindex="-1"></a>    LeakyReLU<span class="op">,</span> LSTM<span class="op">,</span> Maximum<span class="op">,</span> MaxPooling1D<span class="op">,</span> MaxPooling2D<span class="op">,</span> Minimum<span class="op">,</span> Multiply<span class="op">,</span> Permute<span class="op">,</span></span>
<span id="cb45-11"><a href="#cb45-11" aria-hidden="true" tabindex="-1"></a>    PReLU<span class="op">,</span> ReLU<span class="op">,</span> RepeatVector<span class="op">,</span> Reshape<span class="op">,</span> SeparableConv1D<span class="op">,</span> SeparableConv2D<span class="op">,</span> Softmax<span class="op">,</span></span>
<span id="cb45-12"><a href="#cb45-12" aria-hidden="true" tabindex="-1"></a>    SpatialDropout1D<span class="op">,</span> SpatialDropout2D<span class="op">,</span> Subtract<span class="op">,</span> ThresholdedReLU<span class="op">,</span> TimeDistributed<span class="op">,</span></span>
<span id="cb45-13"><a href="#cb45-13" aria-hidden="true" tabindex="-1"></a>    UpSampling1D<span class="op">,</span> UpSampling2D<span class="op">,</span> ZeroPadding1D<span class="op">,</span> ZeroPadding2D</span>
<span id="cb45-14"><a href="#cb45-14" aria-hidden="true" tabindex="-1"></a>26 custom operators found</span>
<span id="cb45-15"><a href="#cb45-15" aria-hidden="true" tabindex="-1"></a>    Abs<span class="op">,</span> Acos<span class="op">,</span> Acosh<span class="op">,</span> Asin<span class="op">,</span> Asinh<span class="op">,</span> Atan<span class="op">,</span> Atanh<span class="op">,</span> Ceil<span class="op">,</span> Clip<span class="op">,</span> Cos<span class="op">,</span> Exp<span class="op">,</span> Fill<span class="op">,</span></span>
<span id="cb45-16"><a href="#cb45-16" aria-hidden="true" tabindex="-1"></a>    FloorDiv<span class="op">,</span> FloorMod<span class="op">,</span> Gather<span class="op">,</span> Lambda<span class="op">,</span> Log<span class="op">,</span> Pow<span class="op">,</span> Reshape<span class="op">,</span> Round<span class="op">,</span> Shape<span class="op">,</span> Sign<span class="op">,</span></span>
<span id="cb45-17"><a href="#cb45-17" aria-hidden="true" tabindex="-1"></a>    Sin<span class="op">,</span> Sqrt<span class="op">,</span> Square<span class="op">,</span> Tanh</span></code></pre></div></li>
<li><p>Generate the list of the supported ONNX operators</p>
<div class="sourceCode" id="cb46"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb46-1"><a href="#cb46-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai supported<span class="op">-</span>ops <span class="op">-</span>t onnx</span></code></pre></div></li>
<li><p>Generate the list of the supported tflite operators</p>
<div class="sourceCode" id="cb47"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb47-1"><a href="#cb47-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai supported<span class="op">-</span>ops <span class="op">-</span>t tflite</span></code></pre></div></li>
<li><p>Generate the list of the supported Keras operators with a full report</p>
<div class="sourceCode" id="cb48"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb48-1"><a href="#cb48-1" aria-hidden="true" tabindex="-1"></a>$ stm32ai supported<span class="op">-</span>ops <span class="op">-</span>t keras <span class="op">--</span>with<span class="op">-</span>report</span>
<span id="cb48-2"><a href="#cb48-2" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span>
<span id="cb48-3"><a href="#cb48-3" aria-hidden="true" tabindex="-1"></a>Building report<span class="op">..</span></span>
<span id="cb48-4"><a href="#cb48-4" aria-hidden="true" tabindex="-1"></a>creating file <span class="op">:</span> <span class="op">&lt;</span>output<span class="op">-</span>directory<span class="op">-</span>path<span class="op">&gt;/</span>supported_ops_keras<span class="op">.</span><span class="fu">md</span></span></code></pre></div></li>
</ul>
<!-- External ST resources/links -->
<!-- Internal resources/links -->
<!-- External resources/links -->
<!-- Cross references -->
</section>
</section>
<section id="references" class="level1">
<h1>References</h1>
<table>
<colgroup>
<col style="width: 18%" />
<col style="width: 81%" />
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">ref</th>
<th style="text-align: left;">description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">[DS]</td>
<td style="text-align: left;">X-CUBE-AI - AI expansion pack for STM32CubeMX <a href="https://www.st.com/en/embedded-software/x-cube-ai.html">https://www.st.com/en/embedded-software/x-cube-ai.html</a></td>
</tr>
<tr class="even">
<td style="text-align: left;">[UM]</td>
<td style="text-align: left;">User manual - Getting started with X-CUBE-AI Expansion Package for Artificial Intelligence (AI) <a href="https://www.st.com/resource/en/user_manual/dm00570145.pdf">(pdf)</a></td>
</tr>
<tr class="odd">
<td style="text-align: left;">[CLI]</td>
<td style="text-align: left;">stm32ai - Command Line Interface <a href="command_line_interface.html">(link)</a></td>
</tr>
<tr class="even">
<td style="text-align: left;">[API]</td>
<td style="text-align: left;">Embedded inference client API <a href="embedded_client_api.html">(link)</a></td>
</tr>
<tr class="odd">
<td style="text-align: left;">[METRIC]</td>
<td style="text-align: left;">Evaluation report and metrics <a href="evaluation_metrics.html">(link)</a></td>
</tr>
<tr class="even">
<td style="text-align: left;">[TFL]</td>
<td style="text-align: left;">TensorFlow Lite toolbox <a href="supported_ops_tflite.html">(link)</a></td>
</tr>
<tr class="odd">
<td style="text-align: left;">[KERAS]</td>
<td style="text-align: left;">Keras toolbox <a href="supported_ops_keras.html">(link)</a></td>
</tr>
<tr class="even">
<td style="text-align: left;">[ONNX]</td>
<td style="text-align: left;">ONNX toolbox <a href="supported_ops_onnx.html">(link)</a></td>
</tr>
<tr class="odd">
<td style="text-align: left;">[FAQS]</td>
<td style="text-align: left;">FAQ <a href="faq_generic.html">generic</a>, <a href="faq_validation.html">validation</a>, <a href="faq_quantization.html">quantization</a></td>
</tr>
<tr class="even">
<td style="text-align: left;">[QUANT]</td>
<td style="text-align: left;">Quantization and quantize command <a href="quantization.html">(link)</a></td>
</tr>
<tr class="odd">
<td style="text-align: left;">[RELOC]</td>
<td style="text-align: left;">Relocatable binary network support <a href="relocatable.html">(link)</a></td>
</tr>
<tr class="even">
<td style="text-align: left;">[CUST]</td>
<td style="text-align: left;">Support of the Keras Lambda/custom layers <a href="keras_lambda_custom.html">(link)</a></td>
</tr>
<tr class="odd">
<td style="text-align: left;">[TFLM]</td>
<td style="text-align: left;">TensorFlow Lite for Microcontroller support <a href="tflite_micro_support.html">(link)</a></td>
</tr>
<tr class="even">
<td style="text-align: left;">[INST]</td>
<td style="text-align: left;">Setting the environment <a href="setting_env.html">(link)</a></td>
</tr>
<tr class="odd">
<td style="text-align: left;">[OBS]</td>
<td style="text-align: left;">Platform Observer API <a href="api_platform_observer.html">(link)</a></td>
</tr>
<tr class="even">
<td style="text-align: left;">[C-RUN]</td>
<td style="text-align: left;">Executing locally a generated c-model <a href="how_to_run_a_model_locally.html">(link)</a></td>
</tr>
</tbody>
</table>
</section>



<section class="st_footer">

<h1> <br> </h1>

<p style="font-family:verdana; text-align:left;">
 Embedded Documentation 

	- <b> Command Line Interface </b>
			<br> X-CUBE-AI Expansion Package
	 
			<br> r4.0
		 - AI PLATFORM r7.0.0
			 (Embedded Inference Client API 1.1.0) 
			 - Command Line Interface r1.5.1 
		
	
</p>

<img src="" title="ST logo" align="right" height="100" />

<div class="st_notice">
Information in this document is provided solely in connection with ST products.
The contents of this document are subject to change without prior notice.
<br>
© Copyright STMicroelectronics 2020. All rights reserved. <a href="http://www.st.com">www.st.com</a>
</div>

<hr size="1" />
</section>


</article>
</body>

</html>
